summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schmitzer <noreply@maennchen1.de>2024-09-17 13:26:02 +0000
committerDaniel Schmitzer <noreply@maennchen1.de>2024-09-17 13:26:02 +0000
commita44accbac054db8cd9cceeffc3f5086ab1190c47 (patch)
treec13c36694f40ce84c3d8ec28faca8aee6558a32d
parentf6a39ec9dd9ed200cd6d97c790f5e422f3d6901c (diff)
- Optionale Produktbestandsanzeige
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@8430 0d5edaf7-2b12-4e95-93f4-047927463d4b
-rw-r--r--views/mods/mod_productvariants/settings_edit.phtml4
-rw-r--r--views/mods/mod_stock/product_addedit_content.phtml11
-rw-r--r--views/produkttemplates/standard.phtml27
3 files changed, 39 insertions, 3 deletions
diff --git a/views/mods/mod_productvariants/settings_edit.phtml b/views/mods/mod_productvariants/settings_edit.phtml
index 6f9aa6f..ebbd8c1 100644
--- a/views/mods/mod_productvariants/settings_edit.phtml
+++ b/views/mods/mod_productvariants/settings_edit.phtml
@@ -30,6 +30,10 @@
'hint' => __('Ist diese Option aktiv, so wird bei Kauf der Bestand in den Varianten nicht verringert.', 'wpsg'), 'help' => 'wpsg_vp_product_stock_varinotchange'
]); ?>
+ <?php echo wpsg_drawForm_Checkbox('wpsg_vp_product_stock_display', __('Produktbestand statt Variantenbestand anzeigen', 'wpsg'), $this->get_option('wpsg_vp_product_stock_display'), [
+ 'hint' => __('Ist diese Option aktiv, so wird im nur der Produktbestand im PRodukttemplate (Frontend) angezeigt..', 'wpsg'), 'help' => 'wpsg_vp_product_stock_display'
+ ]); ?>
+
</div>
</div>
diff --git a/views/mods/mod_stock/product_addedit_content.phtml b/views/mods/mod_stock/product_addedit_content.phtml
index ede1099..d7b3f63 100644
--- a/views/mods/mod_stock/product_addedit_content.phtml
+++ b/views/mods/mod_stock/product_addedit_content.phtml
@@ -52,6 +52,17 @@
'hint' => __('Ist hier "nicht verringern" aktiviert, so wird der Bestand in der Variante beim Kauf nicht reduziert.', 'wpsg')
]); ?>
+ <?php echo wpsg_drawForm_Select('meta[wpsg_vp_product_stock_display]', __('Produktbestand in Varianten nicht verringern', 'wpsg'), [
+ '0' => wpsg_translate(
+ __('Voreinstellung (#1#)', 'wpsg'),
+ (($this->get_option('wpsg_vp_product_stock_display') === '1')?'Produktbestand':'Variantenbestand')
+ ),
+ '2' => __('Variantenbestand'),
+ '1' => __('Produktbestand')
+ ], $oProduct->getMeta('wpsg_vp_product_stock_display'), [
+ 'hint' => __('Bestimmt ob der Variantenbestand (Produktbestand + Variantenbestand) oder nur der Produktbestand im Frontend angezeigt werden soll.', 'wpsg')
+ ]); ?>
+
<?php } ?>
<?php /* Mailbenachrichtigung beim Erreichen des Minimalbestandes des Produktes */ ?>
diff --git a/views/produkttemplates/standard.phtml b/views/produkttemplates/standard.phtml
index 13e8357..c517bd8 100644
--- a/views/produkttemplates/standard.phtml
+++ b/views/produkttemplates/standard.phtml
@@ -189,14 +189,35 @@
<div class="wpsg_clear"></div>
<?php /* Lagerbestand START*/ ?>
- <?php if ($this->hasMod('wpsg_mod_stock') && $this->get_option('wpsg_mod_stock_showProduct') == '1') { ?>
+ <?php
+
+ if ($this->hasMod('wpsg_mod_stock') && $this->get_option('wpsg_mod_stock_showProduct') == '1') {
+
+ $stock_source_display = '0'; // Variantenbestand
+
+ if ($oProduct->getMeta('wpsg_vp_product_stock_display', false, '0') === '0') {
+
+ // Einstellung
+ if ($this->get_option('wpsg_vp_product_stock_display') === '1') $stock_source_display = '1';
+
+ } else if ($oProduct->getMeta('wpsg_vp_product_stock_display') === '1') {
+
+ $stock_source_display = '1'; // Produktbestand
+
+ }
+
+ $stock_display = $this->view['data']['stock'];
+
+ if ($stock_source_display === '1') $stock_display = $oProduct->__get('stock');
+
+ ?>
<div class="wpsg_mod_produktindex_stock">
- <?php if (intval($this->view['data']['stock']) > 0) {?>
+ <?php if ($stock_display > 0) {?>
<label><?php echo __('Lagerbestand', 'wpsg'); ?></label>
- <?php echo wpsg_translate(__('#1# Artikel auf Lager','wpsg'), $this->view['data']['stock']); ?>
+ <?php echo wpsg_translate(__('#1# Artikel auf Lager','wpsg'), $stock_display); ?>
<?php } else { ?>