7173 |
daniel |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Template für das hinzufügen von Produkten zur Bestellung
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
?>
|
|
|
8 |
|
|
|
9 |
<style>
|
|
|
10 |
|
|
|
11 |
#product_search { width:100%; }
|
|
|
12 |
|
|
|
13 |
</style>
|
|
|
14 |
|
|
|
15 |
<form id="wpsg_product_add_form">
|
|
|
16 |
|
|
|
17 |
<div class="autocomplete_wrap">
|
|
|
18 |
<input type="text" id="product_search" name="product_serch" value="" placeholder="<?php echo __('Produktsuche', 'wpsg'); ?>" />
|
|
|
19 |
</div>
|
|
|
20 |
|
|
|
21 |
<hr />
|
|
|
22 |
|
|
|
23 |
<div id="wpsg_product_add_target">
|
|
|
24 |
|
|
|
25 |
</div>
|
|
|
26 |
|
|
|
27 |
</form>
|
|
|
28 |
|
|
|
29 |
<script>
|
|
|
30 |
|
|
|
31 |
function wpsg_loadProduct(product_id, order_product_id) {
|
|
|
32 |
|
|
|
33 |
jQuery('#wpsg_product_add_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
|
|
|
34 |
|
|
|
35 |
jQuery.ajax( {
|
|
|
36 |
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']; ?>',
|
|
|
37 |
data: {
|
|
|
38 |
product_id: product_id,
|
|
|
39 |
order_product_id: order_product_id
|
|
|
40 |
},
|
|
|
41 |
success: function(data) {
|
|
|
42 |
|
|
|
43 |
jQuery('#wpsg_product_add_target').html(data);
|
|
|
44 |
|
|
|
45 |
}
|
|
|
46 |
} );
|
|
|
47 |
|
|
|
48 |
} // function wpsg_loadProduct(product_id, order_product_id)
|
|
|
49 |
|
|
|
50 |
jQuery(document).ready(function() {
|
|
|
51 |
|
|
|
52 |
jQuery('#wpsg_product_add_form').on('submit', function() { return false; } );
|
|
|
53 |
|
|
|
54 |
jQuery('#product_search').autocomplete( {
|
|
|
55 |
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']; ?>',
|
|
|
56 |
minLength: 2,
|
|
|
57 |
appendTo: ".autocomplete_wrap",
|
|
|
58 |
select: function(event, ui) {
|
|
|
59 |
|
|
|
60 |
wpsg_loadProduct(ui.item.id, <?php echo ((wpsg_isSizedInt($_REQUEST['order_product_id']))?$_REQUEST['order_product_id']:0); ?>);
|
|
|
61 |
|
|
|
62 |
return false;
|
|
|
63 |
|
|
|
64 |
}
|
|
|
65 |
} );
|
|
|
66 |
|
|
|
67 |
<?php if (wpsg_isSizedInt($_REQUEST['order_product_id'])) { ?>
|
|
|
68 |
|
|
|
69 |
wpsg_loadProduct(0, <?php echo $_REQUEST['order_product_id']; ?>);
|
|
|
70 |
|
|
|
71 |
<?php } else { ?>
|
|
|
72 |
|
|
|
73 |
jQuery('#product_search').focus();
|
|
|
74 |
|
|
|
75 |
<?php } ?>
|
|
|
76 |
|
|
|
77 |
} );
|
|
|
78 |
|
|
|
79 |
</script>
|