Subversion Repositories wpShopGermany4

Rev

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