Subversion Repositories wpShopGermany4

Rev

Rev 7173 | Rev 7974 | Go to most recent revision | 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 eines Produktes wenn das Produkt ausgewählt wurde
5
     */
6
 
7
    /** @var wpsg_product $oProduct */
8
    $oProduct = $this->view['oProduct'];
9
 
10
    /** @var wpsg_order_product $oOrderProduct */
11
    $oOrderProduct = $this->view['oOrderProduct'];
12
 
13
?>
14
 
15
<style>
16
 
17
    .wpsg_product_add { position:relative; min-height:150px; }
18
    .wpsg_product_add .image { position:absolute; left:0px; top:10px; }
19
 
20
</style>
21
 
22
<strong><?php echo $oProduct->getProductName(); ?></strong>
23
 
24
<div class="wpsg_product_add">
25
 
26
    <input type="hidden" name="product_id" value="<?php echo $oProduct->id; ?>" />
27
 
28
    <?php if ($oOrderProduct !== false) { ?>
29
    <input type="hidden" name="order_product_id" value="<?php echo $oOrderProduct->id; ?>" />
30
    <?php } ?>
31
 
32
    <?php
33
 
34
        $attachment_id = $GLOBALS['wpsg_sc']->imagehandler->getAttachmentID($oProduct->id);
35
 
36
    ?>
37
 
38
    <?php if (wpsg_isSizedInt($attachment_id)) { ?>
39
    <div class="image"><?php echo wp_get_attachment_image($attachment_id, [100, 100]); ?></div>
40
    <?php } ?>
41
 
7210 daniel 42
    <?php echo wpsg_drawForm_Input('add_price', __('Produktpreis', 'wpsg').' '.(($this->getBackendTaxView() === WPSG_BRUTTO)?'(BRUTTO)':'(NETTO'), wpsg_ff((($oOrderProduct !== false)?$oOrderProduct->getPrice($this->getBackendTaxView()):$oProduct->getPrice($this->getBackendTaxView())), $this->get_option('wpsg_currency'))); ?>
7173 daniel 43
    <?php echo wpsg_drawForm_Input('add_amount', __('Menge', 'wpsg'), (($oOrderProduct !== false)?$oOrderProduct->getCount():'1')); ?>
7210 daniel 44
    <?php echo wpsg_drawForm_Checkbox('add_eu',__('EU-Leistungsortregel anwenden', 'wpsg'),(($oOrderProduct !== false)?$oOrderProduct->euleistungsortregel:'1')) ?>
45
 
46
    <?php if ($this->callMod('wpsg_mod_productvariants', 'isVariantsProduct', [$oProduct->id])) {
47
 
48
    	$arVariants = $this->callMod('wpsg_mod_productvariants', 'getVariants', [$oProduct->id, true, true, true]);
49
 
50
    	if ($oOrderProduct !== false) $arVariantenInfoArray = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', [$oOrderProduct->getProductKey()]);
51
    	else $arVariantenInfoArray = [];
52
 
53
    	?>
7173 daniel 54
 
55
        <?php if (wpsg_isSizedArray($arVariants)) { ?>
56
 
57
            <br />
58
 
59
            <?php foreach ($arVariants as $var_id => $var_data) {
60
 
61
                    $arVariSelect = [];
62
                    foreach ($var_data['arVariation'] as $vari_id => $vari_data) $arVariSelect[$vari_id] = $vari_data['name'];
63
 
64
                ?>
65
 
7210 daniel 66
                <?php echo wpsg_drawForm_Select('wpsg_vp['.$var_id.']', $var_data['name'], $arVariSelect,$arVariantenInfoArray[$var_data['id']]['vari_id'], ['field_class' => 'varichange']); ?>
7173 daniel 67
 
68
            <?php } ?>
69
 
70
        <?php } ?>
7210 daniel 71
 
72
		<script>
73
 
74
			jQuery('.varichange').on('change', function() {
75
 
76
				jQuery('#add_price').val('..');
77
 
78
				jQuery.ajax( {
79
					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=updatePrice&noheader=1&product_id=<?php echo $oProduct->id; ?>',
80
					data: {
81
						form_data: jQuery('#wpsg_product_add_form').serialize()
82
					},
83
					success: function(data) {
84
 
85
						jQuery('#add_price').val(data);
86
 
87
					}
88
				} );
89
 
90
			} );
91
 
92
		</script>
7173 daniel 93
 
94
    <?php } ?>
95
 
96
    <script>
97
 
98
        jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', false);
99
 
100
    </script>
101
 
102
</div>