1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
<?php
/** @version 4.6.1 */
declare(strict_types=1);
/**
* @author: Daniel Schmitzer
* @date: 10.04.26
* @time: 09:10
*/
namespace wpsgRevocation;
use \wpsg\M1;
use wpsg_product;
use wpsg_ShopController;
$arReason = \wpsgRevocation\Revocation::getReasons();
// Produkte
$dialog_config = json_decode((wp_kses_stripslashes($_REQUEST['dialog_config']??'[]')), true);
$contact_email = "";
$customer_login_id = intval(\wpsg_ShopController::getShop()->callMod('wpsg_mod_kundenverwaltung', 'isLoggedIn'));
if ($customer_login_id > 0) {
$oCustomer = \wpsg_customer::getInstance($customer_login_id);
$contact_email = $oCustomer->getEmail();
}
?>
<form id="wpsg_revocation_form" class="wpsg">
<div id="msg_target"></div>
<?php if (sizeof($dialog_config['arOrderProductID']) > 0) { ?>
<?php foreach ($dialog_config['arOrderProductID'] as $row) {
$order_id = intval($row['order_id']);
$order_product_id = intval($row['order_product_id']);
$amount = intval($row['amount']);
$oOrder = \wpsg_order::getInstance($order_id);
$oOrderProduct = \wpsg_order_product::getInstance($order_product_id);
if (!$oOrder->isLoaded() || !$oOrderProduct->isLoaded()) continue;
$key = $order_id.'_'.$order_product_id;
$id = 'wpsg_rvd_'.$key; // eindeutige ids für die Beschriftungen (W5)
?>
<fieldset class="wpsg_revocation_order_product">
<legend><?php echo \esc_html((string)$oOrderProduct->getProduct()->getProductName()); ?></legend>
<div>
<input type="hidden" readonly name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_product_id]" value="<?php echo intval($oOrderProduct->getId()); ?>" />
<div class="form_field">
<label class="label" for="<?php echo $id; ?>_order_nr"><?php echo __('Bestellnummer / Menge', 'wpsg'); ?></label>
<div class="value">
<input type="text" readonly id="<?php echo $id; ?>_order_nr" name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_nr]" value="<?php echo \esc_attr((string)$oOrder->getNr()); ?>" />
<input type="number" min="1" max="<?php echo $amount; ?>" aria-label="<?php echo \esc_attr__('Menge', 'wpsg'); ?>" name="wpsg_revocation_reason[row][<?php echo $key; ?>][amount]" value="<?php echo $amount; ?>" />
</div>
</div>
<div class="form_field">
<label class="label" for="<?php echo $id; ?>_reason"><?php echo __('Widerrufsgrund', 'wpsg'); ?></label>
<div class="value">
<select id="<?php echo $id; ?>_reason" name="wpsg_revocation_reason[row][<?php echo $key; ?>][reason]">
<option value=""><?php echo __("Keinen Grund angeben", 'wpsg') ?></option>
<?php foreach ($arReason as $reason) { ?>
<option value="<?php echo htmlspecialchars($reason['id']); ?>"><?php echo htmlspecialchars($reason['text']); ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form_field">
<label class="label" for="<?php echo $id; ?>_comment"><?php echo __('Bemerkung', 'wpsg'); ?></label>
<div class="value">
<textarea id="<?php echo $id; ?>_comment" name="wpsg_revocation_reason[row][<?php echo $key; ?>][comment]"></textarea>
</div>
</div>
</div>
</fieldset>
<?php } ?>
<?php } else {
$key = 0;
$id = 'wpsg_rvd_0';
?>
<fieldset class="wpsg_revocation_order_product">
<div class="form_field">
<label class="label" for="<?php echo $id; ?>_product_nr"><?php echo __('Artikel - Nr.', 'wpsg'); ?></label>
<div class="value">
<input type="text" id="<?php echo $id; ?>_product_nr" name="wpsg_revocation_reason[row][<?php echo $key; ?>][product_nr]" value="<?php echo \esc_attr((string)($dialog_config['set_product_anr']??'')); ?>" />
</div>
</div>
<div class="form_field">
<label class="label" for="<?php echo $id; ?>_order_nr"><?php echo __('Bestellnummer / Menge', 'wpsg'); ?></label>
<div class="value">
<input type="text" id="<?php echo $id; ?>_order_nr" name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_nr]" value="" />
<input type="number" aria-label="<?php echo \esc_attr__('Menge', 'wpsg'); ?>" name="wpsg_revocation_reason[row][<?php echo $key; ?>][amount]" value="1" />
</div>
</div>
<div class="form_field">
<label class="label" for="<?php echo $id; ?>_reason"><?php echo __('Widerrufsgrund', 'wpsg'); ?></label>
<div class="value">
<select id="<?php echo $id; ?>_reason" name="wpsg_revocation_reason[row][<?php echo $key; ?>][reason]">
<option value=""><?php echo __("Keinen Grund angeben", 'wpsg') ?></option>
<?php foreach ($arReason as $reason) { ?>
<option value="<?php echo htmlspecialchars($reason['id']); ?>"><?php echo htmlspecialchars($reason['text']); ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form_field">
<label class="label" for="<?php echo $id; ?>_comment"><?php echo __('Bemerkung', 'wpsg'); ?></label>
<div class="value">
<textarea id="<?php echo $id; ?>_comment" name="wpsg_revocation_reason[row][<?php echo $key; ?>][comment]"></textarea>
</div>
</div>
</fieldset>
<?php } ?>
<div class="form_field">
<label class="label" for="wpsg_rvd_contact"><?php echo __('Kontakt - E-Mail', 'wpsg'); ?></label>
<div class="value">
<input type="email" required id="wpsg_rvd_contact" autocomplete="email" name="wpsg_revocation_reason[contact]" value="<?php echo \esc_attr($contact_email); ?>"
<?php echo (($contact_email !== '')?'readonly':''); ?>
/>
</div>
</div>
<p>
<?php echo \esc_html__('Es gelten unsere', 'wpsg'); ?>
<a href="<?php echo \esc_url(\wpsg_ShopController::getShop()->getURL(wpsg_ShopController::URL_DATENSCHUTZ)); ?>"><?php echo \esc_html__('Datenschutzbestimmungen', 'wpsg'); ?></a>.
</p>
</form>
|