blob: e833a00147dedde8020cb1ebdb264bcaae223e21 (
plain)
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
|
<?php
declare(strict_types=1);
/**
* @author: Daniel Schmitzer
* @date: 10.04.26
* @time: 09:10
*/
namespace wpsgRevocation;
use \wpsg\M1;
use wpsg_product;
$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;
?>
<fieldset class="wpsg_revocation_order_product">
<legend><?php echo $oOrderProduct->getProduct()->getProductName(); ?></legend>
<div>
<input type="hidden" readonly name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_product_id]" value="<?php echo $oOrderProduct->getId(); ?>" />
<div class="form_field">
<div class="label"><?php echo __('Bestellnummer / Menge', 'wpsgRevocation'); ?></div>
<div class="value">
<input type="text" readonly name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_nr]" value="<?php echo $oOrder->getNr(); ?>" />
<input type="number" min="1" max="<?php echo $amount; ?>" name="wpsg_revocation_reason[row][<?php echo $key; ?>][amount]" value="<?php echo $amount; ?>" />
</div>
</div>
<div class="form_field">
<div class="label"><?php echo __('Widerrufsgrund', 'wpsgRevocation'); ?></div>
<div class="value">
<select name="wpsg_revocation_reason[row][<?php echo $key; ?>][reason]" required>
<option value=""><?php echo __('Bitte einen Grund auswählen', 'wpsgRevocation'); ?></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">
<div class="label"><?php echo __('Bemerkung', 'wpsgRevocation'); ?></div>
<div class="value">
<textarea name="wpsg_revocation_reason[row][<?php echo $key; ?>][comment]"></textarea>
</div>
</div>
</div>
</fieldset>
<?php } ?>
<?php } else {
$key = 0;
?>
<fieldset class="wpsg_revocation_order_product">
<div class="form_field">
<div class="label"><?php echo __('Produkt - Nr.', 'wpsgRevocation'); ?></div>
<div class="value">
<input type="text" name="wpsg_revocation_reason[row][<?php echo $key; ?>][product_nr]" value="<?php echo ($dialog_config['set_product_anr']??''); ?>" />
</div>
</div>
<div class="form_field">
<div class="label"><?php echo __('Bestellnummer / Menge', 'wpsgRevocation'); ?></div>
<div class="value">
<input type="text" name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_nr]" value="" />
<input type="number" name="wpsg_revocation_reason[row][<?php echo $key; ?>][amount]" value="1" />
</div>
</div>
<div class="form_field">
<div class="label"><?php echo __('Widerrufsgrund', 'wpsgRevocation'); ?></div>
<div class="value">
<select name="wpsg_revocation_reason[row][<?php echo $key; ?>][reason]">
<?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">
<div class="label"><?php echo __('Bemerkung', 'wpsgRevocation'); ?></div>
<div class="value">
<textarea name="wpsg_revocation_reason[row][<?php echo $key; ?>][comment]"></textarea>
</div>
</div>
</fieldset>
<?php } ?>
<div class="form_field">
<div class="label"><?php echo __('Kontakt - E-Mail', 'wpsgRevocation'); ?></div>
<div class="value">
<input type="email" required name="wpsg_revocation_reason[contact]" value="<?php echo $contact_email; ?>"
<?php echo (($contact_email !== '')?'readonly':''); ?>
/>
</div>
</div>
</form>
|