diff options
| author | daniel <noreply@maennchen1.de> | 2026-09-24 10:49:44 +0200 |
|---|---|---|
| committer | daniel <noreply@maennchen1.de> | 2026-09-24 10:49:44 +0200 |
| commit | 19a8938fa3b41a6c6ed1e15c20586f860f4a637b (patch) | |
| tree | 353780fc47092183e6825bde59435208377bdb38 /views/mods/mod_discount/settings_edit.phtml | |
| parent | ca5fd820c76aa73f64c9ca7966bac32a89ac9248 (diff) | |
- Feature: PHP 8.3 Kompatibilität
- Feature: SmartCheckout - Ersatz für EinSeitenCheckout
- Feature: Optik im Frontend an moderne Themes angepasst
Diffstat (limited to 'views/mods/mod_discount/settings_edit.phtml')
| -rw-r--r-- | views/mods/mod_discount/settings_edit.phtml | 130 |
1 files changed, 101 insertions, 29 deletions
diff --git a/views/mods/mod_discount/settings_edit.phtml b/views/mods/mod_discount/settings_edit.phtml index 33e6d02..d2b645c 100644 --- a/views/mods/mod_discount/settings_edit.phtml +++ b/views/mods/mod_discount/settings_edit.phtml @@ -57,29 +57,83 @@ </div>
<div role="tabpanel" class="tab-pane" id="tab2">
- <?php echo wpsg_drawForm_TextStart(); ?>
- <div class="wpsg_mod_discount_seriescol"><strong><?php echo __('Bestellwert', 'wpsg'); ?></strong></div>
- <div class="wpsg_mod_discount_seriescol"><strong><?php echo __('Rabatt', 'wpsg'); ?></strong></div>
- <div class="wpsg_mod_discount_seriescol"><strong><?php echo __('Löschen', 'wpsg'); ?></strong></div>
- <div class="wpsg_clear"></div>
-
- <div class="wpsg_mod_discount_seriescol"><?php echo __('ab', 'wpsg').' '.wpsg_ff(0, $this->get_option('wpsg_currency')); ?></div>
- <div class="wpsg_mod_discount_seriescol wpsg_mod_discount_seriescol_sub"><input type="text" name="value[0][rabatt]" value="<?php echo wpsg_ff(@$this->view['data'][0]['rabatt']); ?>" /></div>
- <div class="wpsg_clear"></div>
-
- <?php foreach ($this->view['data'] as $k => $v) { if ($k > 0) { ?>
- <div class="wpsg_mod_discount_seriescol"><?php echo __('ab', 'wpsg').' '.wpsg_ff($v['value'], $this->get_option('wpsg_currency')); ?></div>
- <div class="wpsg_mod_discount_seriescol wpsg_mod_discount_seriescol_sub"><input type="text" name="value[<?php echo $k; ?>][rabatt]" value="<?php echo wpsg_ff($v['rabatt']); ?>" /></div>
- <div class="wpsg_mod_discount_seriescol wpsg_mod_discount_seriescol_sub"><input type="checkbox" name="value[<?php echo $k; ?>][del]" value="1" style="width:20px; float:left; margin-left:20px;"/></div>
- <input type="hidden" name="value[<?php echo $k; ?>][value]" value="<?php echo $v['value']; ?>" /><div class="wpsg_clear"></div>
- <?php } } ?>
-
- <div class="wpsg_mod_discount_seriescol"><?php echo __('ab', 'wpsg'); ?> <input type="text" name="neu[value]" value="" /> <?php echo $this->get_option('wpsg_currency'); ?></div>
- <div class="wpsg_mod_discount_seriescol"><input type="text" name="neu[rabatt]" value="" /></div>
- <a id="wkrimage" style="margin-left:5px;" class="wpsg-glyphicon glyphicon glyphicon-plus" alt="Hinzufügen"></a>
- <div class="wpsg_clear"></div>
- <?php echo wpsg_drawForm_TextEnd(__('Staffelung', 'wpsg'), array('noP' => true)); ?>
-
+ <?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">
@@ -106,8 +160,24 @@ wpsg_switchUniversalDiscount();
} );
- jQuery('#wkrimage').bind('click', function() {
- jQuery('#submit').trigger('click');
+ // 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();
@@ -117,10 +187,12 @@ function wpsg_mod_discount_restoredefaulthierarchie()
{
- jQuery('#wpsg_mod_discount_hierarchie ul').append(jQuery('#wpsg_mod_discount_hierarchie .general'));
- jQuery('#wpsg_mod_discount_hierarchie ul').append(jQuery('#wpsg_mod_discount_hierarchie .product'));
- jQuery('#wpsg_mod_discount_hierarchie ul').append(jQuery('#wpsg_mod_discount_hierarchie .productgroup'));
- jQuery('#wpsg_mod_discount_hierarchie ul').append(jQuery('#wpsg_mod_discount_hierarchie .customer'));
+ 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;
|
