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')); ?>
|
8012 |
karl |
44 |
<?php echo wpsg_drawForm_Checkbox('add_eu',__('EU-Leistungsortregel anwenden', 'wpsg'),(($oOrderProduct !== false)?$oOrderProduct->euleistungsortregel:'0')) ?>
|
7210 |
daniel |
45 |
|
7974 |
daniel |
46 |
<?php if ($this->hasMod('wpsg_mod_scaleprice')) { ?>
|
|
|
47 |
<?php if ($this->callMod('wpsg_mod_scaleprice', 'product_has_scaleprice', [$oProduct->getId()])) { ?>
|
|
|
48 |
|
|
|
49 |
<?php echo wpsg_drawForm_Checkbox('set_scaleprice', __('Produktpreis anhand Preisstaffel ermitteln', 'wpsg'), false); ?>
|
|
|
50 |
|
|
|
51 |
<script>
|
|
|
52 |
|
|
|
53 |
document.getElementById('set_scaleprice').addEventListener('change', (event) => {
|
|
|
54 |
|
|
|
55 |
if (event.target.checked) {
|
|
|
56 |
|
|
|
57 |
document.getElementById('add_price').setAttribute('disabled', 'disabled');
|
|
|
58 |
|
|
|
59 |
} else {
|
|
|
60 |
|
|
|
61 |
document.getElementById('add_price').removeAttribute('disabled');
|
|
|
62 |
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
});
|
|
|
66 |
|
|
|
67 |
</script>
|
|
|
68 |
|
|
|
69 |
<?php } ?>
|
|
|
70 |
<?php } ?>
|
|
|
71 |
|
7210 |
daniel |
72 |
<?php if ($this->callMod('wpsg_mod_productvariants', 'isVariantsProduct', [$oProduct->id])) {
|
|
|
73 |
|
|
|
74 |
$arVariants = $this->callMod('wpsg_mod_productvariants', 'getVariants', [$oProduct->id, true, true, true]);
|
|
|
75 |
|
|
|
76 |
if ($oOrderProduct !== false) $arVariantenInfoArray = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', [$oOrderProduct->getProductKey()]);
|
|
|
77 |
else $arVariantenInfoArray = [];
|
|
|
78 |
|
|
|
79 |
?>
|
7173 |
daniel |
80 |
|
|
|
81 |
<?php if (wpsg_isSizedArray($arVariants)) { ?>
|
|
|
82 |
|
|
|
83 |
<br />
|
|
|
84 |
|
|
|
85 |
<?php foreach ($arVariants as $var_id => $var_data) {
|
|
|
86 |
|
|
|
87 |
$arVariSelect = [];
|
|
|
88 |
foreach ($var_data['arVariation'] as $vari_id => $vari_data) $arVariSelect[$vari_id] = $vari_data['name'];
|
|
|
89 |
|
|
|
90 |
?>
|
|
|
91 |
|
7210 |
daniel |
92 |
<?php echo wpsg_drawForm_Select('wpsg_vp['.$var_id.']', $var_data['name'], $arVariSelect,$arVariantenInfoArray[$var_data['id']]['vari_id'], ['field_class' => 'varichange']); ?>
|
7173 |
daniel |
93 |
|
|
|
94 |
<?php } ?>
|
|
|
95 |
|
|
|
96 |
<?php } ?>
|
7210 |
daniel |
97 |
|
|
|
98 |
<script>
|
|
|
99 |
|
|
|
100 |
jQuery('.varichange').on('change', function() {
|
|
|
101 |
|
|
|
102 |
jQuery('#add_price').val('..');
|
|
|
103 |
|
|
|
104 |
jQuery.ajax( {
|
|
|
105 |
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; ?>',
|
|
|
106 |
data: {
|
|
|
107 |
form_data: jQuery('#wpsg_product_add_form').serialize()
|
|
|
108 |
},
|
|
|
109 |
success: function(data) {
|
|
|
110 |
|
|
|
111 |
jQuery('#add_price').val(data);
|
|
|
112 |
|
|
|
113 |
}
|
|
|
114 |
} );
|
|
|
115 |
|
|
|
116 |
} );
|
|
|
117 |
|
|
|
118 |
</script>
|
7173 |
daniel |
119 |
|
|
|
120 |
<?php } ?>
|
|
|
121 |
|
|
|
122 |
<script>
|
|
|
123 |
|
|
|
124 |
jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', false);
|
|
|
125 |
|
|
|
126 |
</script>
|
|
|
127 |
|
|
|
128 |
</div>
|