Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/**
* Template für das hinzufügen von Produkten zur Bestellung
*/
?>
<style>
#product_search { width:100%; }
</style>
<form id="wpsg_product_add_form">
<div class="autocomplete_wrap">
<input type="text" id="product_search" name="product_serch" value="" placeholder="<?php echo __('Produktsuche', 'wpsg'); ?>" />
</div>
<hr />
<div id="wpsg_product_add_target">
</div>
</form>
<script>
function wpsg_loadProduct(product_id, order_product_id) {
jQuery('#wpsg_product_add_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
jQuery.ajax( {
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=product&noheader=1&edit_id=<?php $_REQUEST['edit_id']; ?>',
data: {
product_id: product_id,
order_product_id: order_product_id
},
success: function(data) {
jQuery('#wpsg_product_add_target').html(data);
}
} );
} // function wpsg_loadProduct(product_id, order_product_id)
jQuery(document).ready(function() {
jQuery('#wpsg_product_add_form').on('submit', function() { return false; } );
jQuery('#product_search').autocomplete( {
source: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=search&noheader=1&edit_id=<?php echo $_REQUEST['edit_id']; ?>',
minLength: 2,
appendTo: ".autocomplete_wrap",
select: function(event, ui) {
wpsg_loadProduct(ui.item.id, <?php echo ((wpsg_isSizedInt($_REQUEST['order_product_id']))?$_REQUEST['order_product_id']:0); ?>);
return false;
}
} );
<?php if (wpsg_isSizedInt($_REQUEST['order_product_id'])) { ?>
wpsg_loadProduct(0, <?php echo $_REQUEST['order_product_id']; ?>);
<?php } else { ?>
jQuery('#product_search').focus();
<?php } ?>
} );
</script>