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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
<?php
/**
* Template für die Einstellungen des Rabatt Moduls
* @version 4.6.1
*/
?>
<div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#tab1" aria-controls="home" role="tab" data-toggle="tab"><?php echo __('Produktrabatt', 'wpsg'); ?></a></li>
<li role="presentation"><a href="#tab2" aria-controls="profile" role="tab" data-toggle="tab"><?php echo __('Warenkorbrabatt', 'wpsg'); ?></a></li>
<li role="presentation"><a href="#tab3" aria-controls="profile" role="tab" data-toggle="tab"><?php echo __('Optionen', 'wpsg'); ?></a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="tab1">
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_productdiscount', __('Rabatt auf Produkte', 'wpsg'), $this->get_option('wpsg_mod_discount_productdiscount'), array('label' => __('Aktivierte Rabatte', 'wpsg'), 'help' =>'wpsg_mod_discount_productdiscount')); ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_universal', __('Rabatt auf alle Produkte', 'wpsg'), $this->get_option('wpsg_mod_discount_universal'), array('help' => 'wpsg_mod_discount_universal')); ?>
<div class="wpsg_form_field" id="wpsg_mod_discount_universal_layer">
<?php echo wpsg_drawForm_TextStart(); ?>
<?php echo wpsg_drawForm_Input('wpsg_mod_discount_universal_from', __('Von (tt.mm.jjjj)', 'wpsg'), $this->get_option('wpsg_mod_discount_universal_from'), array('datepicker' => true)); ?>
<?php echo wpsg_drawForm_Input('wpsg_mod_discount_universal_to', __('Bis (tt.mm.jjjj)', 'wpsg'), $this->get_option('wpsg_mod_discount_universal_to'), array('datepicker' => true)); ?>
<?php echo wpsg_drawForm_Input('wpsg_mod_discount_universal_value', __('Rabatt', 'wpsg'), $this->get_option('wpsg_mod_discount_universal_value'), array()); ?>
<?php echo wpsg_drawForm_TextEnd('', array('noP' => true)); ?>
</div>
<?php if ($this->hasMod('wpsg_mod_productgroups')) { ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_productgroupdiscount', __('Rabatt auf Produktgruppen', 'wpsg'), $this->get_option('wpsg_mod_discount_productgroupdiscount'), array('help' => 'wpsg_mod_discount_productgroupdiscount')); ?>
<?php } ?>
<?php if ($this->hasMod('wpsg_mod_customergroup')) { ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_customergroup', __('Rabatt auf Kundengruppen', 'wpsg'), $this->get_option('wpsg_mod_discount_customergroup'), array('help' => 'wpsg_mod_discount_customergroup')); ?>
<?php } ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_show', __('Originalpreis im Produkttemplate anzeigen', 'wpsg'), $this->get_option('wpsg_mod_discount_show'), array ('help' => 'wpsg_mod_discount_show')); ?>
<br />
<?php echo wpsg_drawForm_TextStart(); ?>
<ul class="wpsg_mod_discount_hirarchieorder">
<?php foreach ($this->view['wpsg_mod_discount']['hierarchie'] as $discount_typ) { ?>
<li class="<?php echo $discount_typ; ?>">
<input type="hidden" name="wpsg_mod_discount_hierarchie[]" value="<?php echo $discount_typ; ?>" />
<?php echo $this->callMod('wpsg_mod_discount', 'getNameFromType', array($discount_typ)); ?>
</li>
<?php } ?>
</ul>
<p class="info"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
<a href="#" onclick="return wpsg_mod_discount_restoredefaulthierarchie();"><?php echo __('Standard wiederherstellen', 'wpsg'); ?></a>
<?php echo wpsg_drawForm_TextEnd(__('Rabattreihenfolge (für Berechnung)', 'wpsg'), array('noP' => true)); ?>
</div>
<div role="tabpanel" class="tab-pane" id="tab2">
<?php
$strCurrency = (string)$this->get_option('wpsg_currency');
$arSeries = (array)($this->view['wpsg_mod_discount']['series']??[]);
?>
<?php /* Die Staffel nutzt die volle Breite des Reiters, daher ohne Label-Spalte von wpsg_drawForm_TextStart() */ ?>
<div class="wpsg_mod_discount_series_wrap">
<h4><?php echo esc_html__('Staffelung', 'wpsg'); ?></h4>
<table class="table table-body-striped wpsg_mod_discount_series" id="wpsg_mod_discount_series">
<thead>
<tr>
<th class="col_value"><?php echo esc_html__('ab Bestellwert', 'wpsg'); ?></th>
<th class="col_rabatt"><?php echo esc_html__('Rabatt', 'wpsg'); ?></th>
<th class="col_typ"><?php echo esc_html__('Art', 'wpsg'); ?></th>
<th class="col_action"></th>
</tr>
</thead>
<tbody>
<?php foreach (array_values($arSeries) as $index => $row) { ?>
<tr class="wpsg_mod_discount_series_row">
<td class="col_value">
<?php if ($index === 0) { ?>
<input type="hidden" name="wpsg_mod_discount_series[0][value]" value="0" />
<span class="wpsg_mod_discount_series_first"><?php echo esc_html(wpsg_ff(0)); ?></span> <?php echo esc_html($strCurrency); ?>
<?php } else { ?>
<input type="text" name="wpsg_mod_discount_series[<?php echo intval($index); ?>][value]" value="<?php echo esc_attr(wpsg_ff($row['value'])); ?>" /> <?php echo esc_html($strCurrency); ?>
<?php } ?>
</td>
<td class="col_rabatt">
<input type="text" name="wpsg_mod_discount_series[<?php echo intval($index); ?>][rabatt]" value="<?php echo esc_attr(wpsg_ff($row['rabatt'])); ?>" />
</td>
<td class="col_typ">
<select name="wpsg_mod_discount_series[<?php echo intval($index); ?>][typ]">
<option value="fix" <?php echo (($row['typ'] === 'fix')?'selected="selected"':''); ?>><?php echo esc_html($strCurrency); ?></option>
<option value="percent" <?php echo (($row['typ'] === 'percent')?'selected="selected"':''); ?>>%</option>
</select>
</td>
<td class="col_action">
<?php if ($index > 0) { ?>
<a href="#" class="wpsg-glyphicon glyphicon glyphicon-trash wpsg_mod_discount_series_remove" title="<?php echo esc_attr__('Staffel entfernen', 'wpsg'); ?>"></a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php /* Vorlage für neue Zeilen, __INDEX__ wird per JavaScript ersetzt */ ?>
<script type="text/html" id="wpsg_mod_discount_series_template">
<tr class="wpsg_mod_discount_series_row">
<td class="col_value">
<input type="text" name="wpsg_mod_discount_series[__INDEX__][value]" value="" /> <?php echo esc_html($strCurrency); ?>
</td>
<td class="col_rabatt">
<input type="text" name="wpsg_mod_discount_series[__INDEX__][rabatt]" value="" />
</td>
<td class="col_typ">
<select name="wpsg_mod_discount_series[__INDEX__][typ]">
<option value="fix"><?php echo esc_html($strCurrency); ?></option>
<option value="percent">%</option>
</select>
</td>
<td class="col_action">
<a href="#" class="wpsg-glyphicon glyphicon glyphicon-trash wpsg_mod_discount_series_remove" title="<?php echo esc_attr__('Staffel entfernen', 'wpsg'); ?>"></a>
</td>
</tr>
</script>
<button type="button" class="button" id="wpsg_mod_discount_series_add"><span class="glyphicon glyphicon-plus"></span> <?php echo esc_html__('Staffel hinzufügen', 'wpsg'); ?></button>
<p class="info"><?php echo esc_html__('Maßgeblich ist der Bestellwert des Warenkorbs. Es gilt die höchste erreichte Staffel, die Reihenfolge der Zeilen spielt keine Rolle und wird beim Speichern sortiert. Leere Zeilen werden ignoriert, Änderungen werden erst mit "Speichern" übernommen.', 'wpsg'); ?></p>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="tab3">
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_stopRabatt', __('Nur ersten Rabatt berücksichtigen', 'wpsg'), $this->get_option('wpsg_mod_discount_stopRabatt')); ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_showBasket', __('Nächste Staffelung im Warenkorb anpreisen', 'wpsg'), $this->get_option('wpsg_mod_discount_showBasket'), array('help' => 'wpsg_mod_discount_showBasket')); ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_voucher', __('Gutscheine bei aktivem Rabatt nicht zulassen', 'wpsg'), $this->get_option('wpsg_mod_discount_voucher'), array('help' => 'wpsg_mod_discount_voucher')); ?>
<?php if ($this->hasMod('wpsg_mod_productindex') == '1') { ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_discount_productindex', __('Rabattierte Preise in Produktindex anzeigen', 'wpsg'), $this->get_option('wpsg_mod_discount_productindex')); ?>
<?php } ?>
</div>
</div>
</div>
<script type="text/javascript">/* <![CDATA[ */
jQuery(document).ready(function() {
jQuery("ul.wpsg_mod_discount_hirarchieorder").sortable().disableSelection();
jQuery('#wpsg_mod_discount_universal').bind('change', function() {
wpsg_switchUniversalDiscount();
} );
// Staffel des Warenkorbrabattes: Zeilen hinzufügen und entfernen, gespeichert wird mit dem Formular
var wpsg_mod_discount_series_index = jQuery('#wpsg_mod_discount_series tbody tr').length;
jQuery('#wpsg_mod_discount_series_add').on('click', function() {
var strRow = jQuery('#wpsg_mod_discount_series_template').html().replace(/__INDEX__/g, wpsg_mod_discount_series_index++);
jQuery('#wpsg_mod_discount_series tbody').append(strRow);
jQuery('#wpsg_mod_discount_series tbody tr:last input:first').trigger('focus');
} );
jQuery('#wpsg_mod_discount_series').on('click', '.wpsg_mod_discount_series_remove', function() {
jQuery(this).closest('tr').remove();
return false;
} );
wpsg_switchUniversalDiscount();
} );
function wpsg_mod_discount_restoredefaulthierarchie()
{
var el_list = jQuery('ul.wpsg_mod_discount_hirarchieorder');
el_list.append(el_list.children('.general'));
el_list.append(el_list.children('.product'));
el_list.append(el_list.children('.productgroup'));
el_list.append(el_list.children('.customer'));
return false;
}
function wpsg_switchUniversalDiscount()
{
if (jQuery('#wpsg_mod_discount_universal').prop('checked'))
{
jQuery('#wpsg_mod_discount_universal_layer').show();
}
else
{
jQuery('#wpsg_mod_discount_universal_layer').hide();
}
}
/* ]]> */</script>
|