Subversion Repositories wpShopGermany4

Rev

Rev 7173 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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>
7561 daniel 28
 
7173 daniel 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( {
7561 daniel 36
            url: '<?php
37
 
38
				echo wpsg_admin_url('Order', 'view', ['subaction' => 'addProduct', 'do' => 'product', 'edit_id' => $_REQUEST['edit_id']], ['noheader' => '1'], true);
39
 
40
			?>',
7173 daniel 41
            data: {
42
                product_id: product_id,
43
                order_product_id: order_product_id
44
            },
45
            success: function(data) {
46
 
47
                jQuery('#wpsg_product_add_target').html(data);
48
 
49
            }
50
        } );
51
 
52
    } // function wpsg_loadProduct(product_id, order_product_id)
53
 
54
    jQuery(document).ready(function() {
55
 
56
        jQuery('#wpsg_product_add_form').on('submit', function() { return false; } );
57
 
58
        jQuery('#product_search').autocomplete( {
7561 daniel 59
            source: '<?php
60
 
61
				echo wpsg_admin_url('Order', 'view', ['subaction' => 'addProduct', 'do' => 'search', 'edit_id' => $_REQUEST['edit_id']], ['noheader' => '1'], true);
62
 
63
			?>',
7173 daniel 64
            minLength: 2,
65
            appendTo: ".autocomplete_wrap",
66
            select: function(event, ui) {
67
 
68
                wpsg_loadProduct(ui.item.id, <?php echo ((wpsg_isSizedInt($_REQUEST['order_product_id']))?$_REQUEST['order_product_id']:0); ?>);
69
 
70
                return false;
71
 
72
            }
73
        } );
74
 
75
        <?php if (wpsg_isSizedInt($_REQUEST['order_product_id'])) { ?>
76
 
77
            wpsg_loadProduct(0, <?php echo $_REQUEST['order_product_id']; ?>);
78
 
79
        <?php } else { ?>
80
 
81
            jQuery('#product_search').focus();
82
 
83
        <?php } ?>
84
 
85
    } );
86
 
87
</script>