Subversion Repositories wpShopGermany4

Rev

Rev 7173 | Rev 7305 | 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 Bearbeiten der Versand- und Zahlungsart im Backend
5
     */
6
 
7217 daniel 7
    $arCalculation = $this->view['oCalculation']->getCalculationArray();
8
 
7173 daniel 9
    $arShippingSelect = [];
10
    foreach ($this->arShipping as $shipping_id => $shipping_data) {
11
 
12
        $arShippingSelect[$shipping_id] = $shipping_data['name'];
13
 
14
        if (wpsg_isSizedDouble($shipping_data['price'])) {
15
 
16
            $arShippingSelect[$shipping_id] .= ' ('.wpsg_ff($shipping_data['price'],$this->get_option('wpsg_currency')).')';
17
 
18
        }
19
 
20
    }
21
 
22
    $arPaymentSelect = [];
23
    foreach ($this->arPayment as $payment_id => $payment_data) {
24
 
25
        $arPaymentSelect[$payment_id] = $payment_data['name'];
26
 
27
        if (wpsg_isSizedDouble($payment_data['preis'])) {
28
 
29
            $arPaymentSelect[$payment_id] .= ' ('.wpsg_ff($payment_data['preis'],$this->get_option('wpsg_currency')).')';
30
 
31
        }
32
 
33
    }
34
 
35
    if ($this->getBackendTaxview() === WPSG_BRUTTO) {
36
 
7217 daniel 37
    	$price_shipping = wpsg_ff(($arCalculation['shipping'][0]['brutto_single']??0), $this->get_option('wpsg_currency'));
38
		$price_payment = wpsg_ff(($arCalculation['payment'][0]['brutto_single']??0), $this->get_option('wpsg_currency'));
39
 
7173 daniel 40
        $price_suffix = ' ('.__('Brutto', 'wpsg').')';
41
 
42
    } else {
7217 daniel 43
 
44
		$price_shipping = wpsg_ff(($arCalculation['shipping'][0]['netto_single']??0), $this->get_option('wpsg_currency'));
45
		$price_payment = wpsg_ff(($arCalculation['payment'][0]['netto_single']??0), $this->get_option('wpsg_currency'));
7173 daniel 46
 
47
        $price_suffix = ' ('.__('Netto', 'wpsg').')';
48
 
49
    }
50
 
51
?>
52
 
53
<div id="editPayShipping">
54
 
55
    <?php echo wpsg_drawForm_Select('edit_shipping_type', __('Versandart', 'wpsg'), $arShippingSelect,$this->view['data']['type_shipping']); ?>
56
    <?php echo wpsg_drawForm_Input('edit_shipping_price', __('Kosten', 'wpsg').$price_suffix, $price_shipping);  ?>
57
 
58
    <br />
59
 
60
    <?php echo wpsg_drawForm_Select('edit_payment_type', __('Zahlungsart', 'wpsg'), $arPaymentSelect,$this->view['data']['type_payment']); ?>
61
    <?php echo wpsg_drawForm_Input('edit_payment_price', __('Kosten', 'wpsg').$price_suffix, $price_payment);  ?>
62
 
63
</div>
64
 
65
<script>
66
 
67
   var arShipping = <?php echo json_encode($this->arShipping); ?>;
68
   var arPayment = <?php echo json_encode($this->arPayment); ?>;
69
 
70
   jQuery('#edit_shipping_type').on('change', function() {
71
 
72
       for (var i in arShipping) {
73
 
74
           if (i == jQuery(this).val()) {
75
 
76
                var price = parseFloat(jQuery('#edit_shipping_price').val().replace('EUR', '').replace(',', '.'));
77
 
78
                if (isNaN(price) || price <= 0) {
79
 
80
                    jQuery('#edit_shipping_price').val(wpsg_number_format(arShipping[i].price, 2, ',') + ' <?php echo $this->get_option('wpsg_currency'); ?>');
81
 
82
                }
83
 
84
           }
85
 
86
       }
87
 
88
   } ).change();
89
 
90
   jQuery('#edit_payment_type').on('change', function() {
91
 
92
       for (var i in arPayment) {
93
 
94
           if (i == jQuery(this).val()) {
95
 
96
               var price = parseFloat(jQuery('#edit_payment_price').val().replace('EUR', '').replace(',', '.'));
97
 
98
               if (isNaN(price) || price <= 0) {
99
 
100
                   jQuery('#edit_payment_price').val(wpsg_number_format(arPayment[i].preis, 2, ',') + ' <?php echo $this->get_option('wpsg_currency'); ?>');
101
 
102
               }
103
 
104
           }
105
 
106
       }
107
 
108
   } ).change();
109
 
110
</script>