summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/mods/mod_printshop/producttemplate.phtml22
-rw-r--r--views/mods/mod_productvariants/admin_html.phtml20
-rw-r--r--views/mods/mod_productvariants/produkt_addedit_content.phtml432
-rw-r--r--views/mods/mod_productvariants/produkt_addedit_content_combination.phtml305
-rw-r--r--views/mods/mod_produktartikel/produkt_edit_allgemein.phtml7
-rw-r--r--views/mods/mod_produktartikel/settings_edit.phtml5
-rw-r--r--views/mods/mod_rechnungen/multi_invoice_pdf.phtml2
-rw-r--r--views/produkt/addedit_productcodes.phtml65
-rw-r--r--views/produkt/index.phtml14
-rw-r--r--views/produkttemplates/standard.phtml40
-rw-r--r--views/produkttemplates/standard2.phtml23
-rw-r--r--views/produkttemplates/standard3.phtml27
12 files changed, 567 insertions, 395 deletions
diff --git a/views/mods/mod_printshop/producttemplate.phtml b/views/mods/mod_printshop/producttemplate.phtml
index 4092bb5..19e3cf0 100644
--- a/views/mods/mod_printshop/producttemplate.phtml
+++ b/views/mods/mod_printshop/producttemplate.phtml
@@ -83,14 +83,24 @@
<?php if ($this->get_option('wpsg_showArticelnumber') == '1') { ?>
<div class="wpsg_artikelnummer">
<?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($this->view['data']['anr']); ?></span><br />
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_ean'))) {?>
- <?php echo __('EAN','wpsg');?>:<span class="wpsg_ean"><?php echo wpsg_hspc($this->view['data']['ean']); ?></span><br />
+ </div>
+ <?php } ?>
+
+ <?php $arProductCodes = $oProduct->getAllProductCodes(); ?>
+ <?php if (sizeof($arProductCodes) > 0) { ?>
+ <div class="product_code_wrap">
+ <?php foreach ($arProductCodes as $product_code) { ?>
+ <?php if ($product_code !== null) { ?>
+
+ <div class="product_code <?php echo $product_code['code_key']; ?>">
+ <span class="label"><?php echo $product_code['label']; ?></span>: <span class="code"><?php echo $product_code['code']; ?></span>
+ </div>
+
+ <?php } ?>
<?php } ?>
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_gtin'))) {?>
- <?php echo __('GTIN','wpsg');?>:<span class="wpsg_gtin"><?php echo wpsg_hspc($this->view['data']['gtin']); ?></span><br />
- <?php }?></div>
+ </div>
<?php } ?>
-
+
<?php /* Abfrage Preisanzeige nur für eingeloggte User aktiv und User eingeloggt START*/ ?>
<?php if ($this->view['oProduct']->canDisplayPrice()) { ?>
diff --git a/views/mods/mod_productvariants/admin_html.phtml b/views/mods/mod_productvariants/admin_html.phtml
index dd225e0..6f49037 100644
--- a/views/mods/mod_productvariants/admin_html.phtml
+++ b/views/mods/mod_productvariants/admin_html.phtml
@@ -210,8 +210,7 @@
}
- function wpsg_mod_productvariants_back()
- {
+ function wpsg_mod_productvariants_back() {
var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
@@ -234,16 +233,17 @@
jQuery('#wpsg_mod_productvariants_dialog .modal-body').html(data);
+ if (window.wpsg_mod_productvariants) window.wpsg_mod_productvariants.updateCombinationData();
+
}
- } );
+ } );
return false;
} // function wpsg_mod_productvariants_back()
- function wpsg_mod_productvariants_show(product_id)
- {
-
+ function wpsg_mod_productvariants_show(product_id) {
+
jQuery('#wpsg_mod_productvariants_dialog button').prop('disabled', true);
jQuery('#wpsg_mod_productvariants_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
@@ -261,11 +261,13 @@
jQuery('#wpsg_mod_productvariants_dialog .modal-body').html(data);
jQuery('#wpsg_mod_productvariants_dialog button').prop('disabled', false);
+ if (window.wpsg_mod_productvariants) window.wpsg_mod_productvariants.updateCombinationData();
+
}
- } );
-
+ } );
+
return false;
- } // function wpsg_mod_productvariants_show()
+ }
</script> \ No newline at end of file
diff --git a/views/mods/mod_productvariants/produkt_addedit_content.phtml b/views/mods/mod_productvariants/produkt_addedit_content.phtml
index e38a1cf..50de7b4 100644
--- a/views/mods/mod_productvariants/produkt_addedit_content.phtml
+++ b/views/mods/mod_productvariants/produkt_addedit_content.phtml
@@ -1,33 +1,425 @@
<?php
-
+
+ declare(strict_types=1);
+
/**
* Template für die Verwaltung der Produktvarianten innerhalb des Produktes
+ * @author: Daniel Schmitzer (daschmi@daschmi.de)
+ * @date: 20.04.23
+ * @time: 11:30
*/
-
+
+ namespace wpsg;
+
?>
-
-<?php echo wpsg_drawForm_AdminboxStart(__('Produktvarianten', 'wpsg')); ?>
-
-<?php if (wpsg_isSizedInt($this->view['data']['id'])) { ?>
- <?php echo $this->view['wpsg_mod_productvariants']['html']; ?>
+<?php if (!wpsg_isSizedInt($this->view['data']['id'])) { ?>
+
+ <p><?php echo __('Bitte speichern Sie das Produkt zuerst.', 'wpsg'); ?></p>
+
+<?php } else {
+
+ /** @var \wpsg_product $oProduct */
+ $oProduct = \wpsg_product::getInstance(intval($this->view['data']['id']));
+
+ ?>
+
+ <?php echo wpsg_drawForm_AdminboxStart(__('Produktvarianten', 'wpsg')); ?>
+
+ <?php echo $this->view['wpsg_mod_productvariants']['html']; ?>
+ <a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants"><span class="wpsg-glyphicon glyphicon glyphicon-wrench"></span><?php echo __('Zur Konfiguration der Produktvarianten', 'wpsg'); ?></a>
+
+ <?php echo wpsg_drawForm_AdminboxEnd(); ?>
- <script type="text/javascript">/* <![CDATA[ */
+ <div id="wpsg_mod_productvars_combination">
+
+ <div v-if="loading" class="loading_layer">
+ <img class="loading" src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />
+ </div>
+
+ <div class="inner">
+ <div class="top_filter">
+ <div v-for="(variant, i) of arVariationen">
+ <select v-model="arFilter[i]">
+ <option :value="0">{{getVariantLabel(i)}} [ Alle ]</option>
+ <option :value="parseInt(variation)" v-for="(variation, j) of variant">{{getVariantLabel(i)}} [{{getVariationLabel(variation)}}]</option>
+ </select>
+ </div>
+ </div>
+ <div v-for="(combination, i) of arPossibleKeysFiltered" class="relative">
+ <div class="panel panel-default">
+ <div class="panel-heading clearfix">
+ <h3 class="panel-title">
+ {{combination.label}}
+ <span v-if="combination.id > 0" class="glyphicon glyphicon-pencil" @click.prevent="edit(combination)"></span>
+ <span v-else class="glyphicon glyphicon-plus" @click.prevent="add(combination)"></span>
+ </h3>
+ </div>
+ <div class="panel-body" v-if="combination.loaded">
+
+ <div v-if="combination.loading" class="loading_layer">
+ <img class="loading" src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />
+ </div>
+
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">Artikelnummer</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.anr" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- EAN -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">EAN (European Article Number)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.ean" maxlength="13" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- GTIN -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">GTIN (Global Trade Item Number)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.gtin" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- MPN -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">MPN (Manufacturer Part Number)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.mpn" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- PZN -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">PZN (Pharmazentralnummer)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.pzn" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- SKU -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">SKU (Stock Keeping Unit)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.sku" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- UPC -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">UPC (Universal Product Code)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.upc" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- ISBN -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">ISBN (International Standard Book Number)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.isbn" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- ISSN -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">ISSN (International Standard Serial Number)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.issn" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <!-- ISIN -->
+ <div class="form-group form-group-sm ">
+ <label class="col-sm-6 control-label" for="detailname">ISIN (International Securities Identification Number)</label>
+ <div class="col-sm-6">
+ <div class="wpsg_field_wrap">
+ <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.isin" />
+ </div>
+ </div>
+ <div class="clearfix wpsg_clear"></div>
+ </div>
+
+ <div class="mt-8 flex w-full justify-end">
+ <input type="submit" @click.prevent="save(combination)" class="button button-primary" value="speichern" />
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <script src="<?php echo WPSG_URL_CONTENT.'plugins/'.WPSG_FOLDERNAME.'/views/js/vue-3.2.47.global.min.js'; ?>"></script>
+ <script>
+
+ const ref = Vue.ref;
+ const computed = Vue.computed;
+ const onMounted = Vue.onMounted;
+
+ const app = Vue.createApp({
+ setup() {
+
+ const product_id = ref(<?php echo $oProduct->getId(); ?>);
+ const loading = ref(true);
+ const arFilter = ref(undefined);
+ const arPossibleKeys = ref(undefined);
+ const arVariant = ref(undefined);
+ const arVariantLabel = ref(undefined);
+ const arVariationen = ref(undefined);
+ const arVariationLabel = ref(undefined);
+
+ const arPossibleKeysFiltered = computed(() => {
+
+ let r = [];
+
+ if (!arPossibleKeys.value) return r;
+
+ for (let var_key of arPossibleKeys.value) {
+
+ const arKey = var_key.var_key.split('|');
+ const typedKey = {};
+
+ for (let i of arKey) {
+
+ const [var_id, vari_id] = i.split(':');
+
+ typedKey[var_id] = parseInt(vari_id);
+
+ }
+
+ let set = true;
+
+ for (let f in arFilter.value) {
+
+ if (arFilter.value[f] !== 0 && typedKey[f] !== arFilter.value[f]) {
+
+ set = false; break;
+
+ }
+
+ }
+
+ if (set) r.push(var_key);
+
+ }
+
+ return r;
+
+ });
+
+ const getVariantLabel = (var_id) => {
+
+ if (arVariantLabel.value[var_id.toString()] !== undefined) return arVariantLabel.value[var_id.toString()];
+ else '';
+
+ };
+ const getVariationLabel = (var_id) => {
+
+ if (arVariationLabel.value[var_id.toString()] !== undefined) return arVariationLabel.value[var_id.toString()];
+ else '';
+
+ };
+ const xhr = (action_do, data, cb_success) => {
+
+ const request = new XMLHttpRequest();
+
+ data.action_do = action_do;
+
+ request.open('POST', '<?php echo WPSG_URL_WP; ?>wp-admin/?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=combination&noheader=1', true);
+ request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
+ request.onload = () => {
+
+ if (request.status >= 200 && request.status < 400) {
+
+ const response = JSON.parse(request.responseText);
+
+ cb_success(response);
+
+ } else {
+
+ console.error('Error: ' + request.statusText);
+
+ }
+
+ };
+
+ request.onerror = function() {
+
+ console.error('Error: ' + request.statusText);
+
+ };
+
+ request.send(JSON.stringify(data));
+
+ };
+ const save = (combination) => {
+
+ xhr('save', {
+ var_key: combination.var_key,
+ product_id: combination.product_id,
+ combination: combination
+ }, (response) => {
+
+ for (let i = 0; i < arPossibleKeys.value.length; i ++) {
+
+ const var_key = arPossibleKeys.value[i];
+
+ if (var_key.var_key === response.combination.var_key) {
+
+ arPossibleKeys.value[i] = response.combination;
+
+ }
+
+ }
+
+ });
+
+ combination.loading = true;
+
+ }
+ const updateCombinationData = () => {
+ xhr('getCombination', {
+ product_id: product_id.value
+ }, (response) => {
+
+ arFilter.value = response.arFilter;
+ arPossibleKeys.value = response.arPossibleKeys;
+ arVariant.value = response.arVariant;
+ arVariantLabel.value = response.arVariantLabel;
+ arVariationen.value = response.arVariationen;
+ arVariationLabel.value = response.arVariationLabel;
+
+ loading.value = false;
+
+ });
+
+ };
+ const add = (combination) => {
+
+ combination.loaded = true;
+ combination.loading = true;
+
+ xhr('add', {
+ var_key: combination.var_key,
+ product_id: product_id.value
+ }, (response) => {
+
+ for (let i = 0; i < arPossibleKeys.value.length; i ++) {
+
+ const var_key = arPossibleKeys.value[i];
+
+ if (var_key.var_key === response.combination.var_key) {
+
+ arPossibleKeys.value[i] = response.combination;
+
+ }
+
+ }
+
+ });
+
+ };
+ const edit = (combination) => {
+
+ combination.loaded = true;
+ combination.loading = true;
+
+ xhr('edit', {
+ var_key: combination.var_key,
+ product_id: product_id.value
+ }, (response) => {
+
+ for (let i = 0; i < arPossibleKeys.value.length; i ++) {
+
+ const var_key = arPossibleKeys.value[i];
+
+ if (var_key.var_key === response.combination.var_key) {
+
+ arPossibleKeys.value[i] = response.combination;
+
+ }
+
+ }
+
+ });
+
+ }
+
+ onMounted(() => {
+
+ // updateCombinationData();
+
+ });
+
+ return {
+ arFilter, arPossibleKeys, arVariant, arVariantLabel, arVariationen, arVariationLabel, product_id, loading,
+ getVariantLabel, getVariationLabel,
+ arPossibleKeysFiltered,
+ add, edit, save, updateCombinationData
+ };
+
+ }
+ }).mount('#wpsg_mod_productvars_combination');
+
+ window.wpsg_mod_productvariants = app;
+
jQuery(document).ready(function() {
-
+
wpsg_mod_productvariants_show(<?php echo $this->view['data']['id']; ?>);
} );
+
+ </script>
+
+ <style>
+
+ #wpsg_mod_productvars_combination { width:100%; position:relative; }
+ #wpsg_mod_productvars_combination .top_filter { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); row-gap:1rem; column-gap:1rem; margin-bottom:2rem; }
+ #wpsg_mod_productvars_combination .top_filter select { width:100%; }
+ #wpsg_mod_productvars_combination .panel-title { display:flex; justify-content:space-between; align-items:center; }
+ #wpsg_mod_productvars_combination .panel-title .glyphicon { cursor:pointer; }
+ #wpsg_mod_productvars_combination .panel { margin-bottom:10px; }
+ #wpsg_mod_productvars_combination .loading_layer { z-index:10; position:absolute; left:0; top:0; width:100%; height:100%; background-color:rgba(255, 255, 255, 0.5); display:flex; justify-content:center; align-items:center; }
+ #wpsg_mod_productvars_combination > .inner { min-height:50px; width:100%; }
+ #wpsg_mod_productvars_combination .flex { display:flex; }
+ #wpsg_mod_productvars_combination .w-full { width:100%; }
+ #wpsg_mod_productvars_combination .justify-end { justify-content:flex-end; }
+ #wpsg_mod_productvars_combination .mt-4 { margin-top:1rem; }
+ #wpsg_mod_productvars_combination .relative { position:relative; }
+ #wpsg_mod_productvars_combination .mt-8 { margin-top:2rem; }
+
+ </style>
- /* ]]> */</script>
-
-<?php } else { ?>
-
- <p><?php echo __('Bitte speichern Sie das Produkt zuerst.', 'wpsg'); ?></p>
-
-<?php } ?>
-
-<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants"><span class="wpsg-glyphicon glyphicon glyphicon-wrench"></span><?php echo __('Zur Konfiguration der Produktvarianten', 'wpsg'); ?></a>
-
-<?php echo wpsg_drawForm_AdminboxEnd(); ?> \ No newline at end of file
+<?php } \ No newline at end of file
diff --git a/views/mods/mod_productvariants/produkt_addedit_content_combination.phtml b/views/mods/mod_productvariants/produkt_addedit_content_combination.phtml
deleted file mode 100644
index 00600ce..0000000
--- a/views/mods/mod_productvariants/produkt_addedit_content_combination.phtml
+++ /dev/null
@@ -1,305 +0,0 @@
-<?php
-
- declare(strict_types=1);
-
- /**
- * Template für die Verwaltung der Produktvarianten innerhalb des Produktes
- * @author: Daniel Schmitzer (daschmi@daschmi.de)
- * @date: 20.04.23
- * @time: 11:30
- */
-
- namespace wpsg;
-
- /** @var \wpsg_product $oProduct */
- $oProduct = \wpsg_product::getInstance(intval($this->view['data']['id']));
-
- $arVariantInfo = $this->callMod('wpsg_mod_productvariants', 'getVariants', [$oProduct->getId(), true, true, true]);
-
- $arVariant = []; $arVariantLabel = []; $arFilter = [];
- $arVariationen = []; $arVariationLabel = [];
-
- foreach ($arVariantInfo as $var) {
-
- $arVariant[] = intval($var['id']);
- $arVariationen[$var['id']] = [];
-
- foreach ($var['arVariation'] as $vari) {
-
- $arVariationen[intval($var['id'])][] = intval($vari['variation_id']);
-
- if (!in_array($var['id'], $arVariationLabel)) try { $arVariationLabel[$vari['variation_id']] = wpsg_variation::getInstance($vari['variation_id'])->getLabel(); } catch (\Exception $e) { $arVariationLabel[$vari['variation_id']] = $vari['variation_id']; }
-
- }
-
- if (!in_array($var['id'], $arVariantLabel)) try { $arVariantLabel[$var['id']] = wpsg_variant::getInstance($var['id'])->getLabel(); } catch (\Exception $e) { $arVariantLabel[$var['id']] = $var['id']; }
-
- $arFilter[$var['id']] = 0;
-
- }
-
- $arPossibleKeys = $oProduct->getPossibleProductVariantKeys();
-
- foreach ($arPossibleKeys as $k => $v) {
-
- $arPossibleKeys[$k]['data'] = null;
-
- try {
-
- $arPossibleKeys[$k]['id'] = intval(wpsg_combination::findByProductAndKey($oProduct->getId(), $v['var_key'])->getId());
-
- } catch (\Throwable $e) { $arPossibleKeys[$k]['id'] = 0; }
-
- }
-
-?>
-
-<div id="wpsg_mod_productvars_combination">
- <div class="top_filter">
- <div v-for="(variant, i) of arVariationen">
- <select v-model="arFilter[i]">
- <option :value="0">{{getVariantLabel(i)}} [ Alle ]</option>
- <option :value="parseInt(variation)" v-for="(variation, j) of variant">{{getVariantLabel(i)}} [{{getVariationLabel(variation)}}]</option>
- </select>
- </div>
- </div>
- <div v-for="(combination, i) of arPossibleKeysFiltered" class="relative">
- <div class="panel panel-default">
- <div class="panel-heading clearfix">
- <h3 class="panel-title">
- {{combination.label}}
- <span v-if="combination.id > 0" class="glyphicon glyphicon-pencil" @click.prevent="edit(combination)"></span>
- <span v-else class="glyphicon glyphicon-plus" @click.prevent="add(combination)"></span>
- </h3>
- </div>
- <div class="panel-body" v-if="combination.loaded">
-
- <div v-if="combination.loading" class="loading_layer">
- <img class="loading" src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />
- </div>
-
- <div class="form-group form-group-sm ">
- <label class="col-sm-6 control-label" for="detailname">Artikelnummer</label>
- <div class="col-sm-6">
- <div class="wpsg_field_wrap">
- <input type="text" class="form-control input-sm " autocomplete="off" placeholder="" v-model="combination.anr">
- </div>
- </div>
- <div class="clearfix wpsg_clear"></div>
- </div>
-
- <div class="mt-8 flex w-full justify-end">
- <input type="submit" @click.prevent="save(combination)" class="button button-primary" value="speichern" />
- </div>
-
- <pre class="mt-8">{{combination}}</pre>
-
- </div>
- </div>
- </div>
-</div>
-
-<script src="<?php echo WPSG_URL_CONTENT.'plugins/'.WPSG_FOLDERNAME.'/views/js/vue-3.2.47.global.min.js'; ?>"></script>
-<script>
-
- const ref = Vue.ref;
- const computed = Vue.computed;
-
- const app = Vue.createApp({
- setup() {
-
- const product_id = ref(<?php echo $oProduct->getId(); ?>);
- const arFilter = ref(<?php echo json_encode($arFilter); ?>);
- const arPossibleKeys = ref(<?php echo json_encode($arPossibleKeys); ?>);
- const arVariant = ref(<?php echo json_encode($arVariant); ?>);
- const arVariantLabel = ref(<?php echo json_encode($arVariantLabel); ?>);
- const arVariationen = ref(<?php echo json_encode($arVariationen); ?>);
- const arVariationLabel = ref(<?php echo json_encode($arVariationLabel); ?>);
-
- const arPossibleKeysFiltered = computed(() => {
-
- let r = [];
-
- for (let var_key of arPossibleKeys.value) {
-
- const arKey = var_key.var_key.split('|');
- const typedKey = {};
-
- for (let i of arKey) {
-
- const [var_id, vari_id] = i.split(':');
-
- typedKey[var_id] = parseInt(vari_id);
-
- }
-
- let set = true;
-
- for (let f in arFilter.value) {
-
- if (arFilter.value[f] !== 0 && typedKey[f] !== arFilter.value[f]) {
-
- set = false; break;
-
- }
-
- }
-
- if (set) r.push(var_key);
-
- }
-
- return r;
-
- });
-
- const getVariantLabel = (var_id) => {
-
- if (arVariantLabel.value[var_id.toString()] !== undefined) return arVariantLabel.value[var_id.toString()];
- else '';
-
- };
- const getVariationLabel = (var_id) => {
-
- if (arVariationLabel.value[var_id.toString()] !== undefined) return arVariationLabel.value[var_id.toString()];
- else '';
-
- };
- const xhr = (action_do, data, cb_success) => {
-
- const request = new XMLHttpRequest();
-
- data.action_do = action_do;
-
- request.open('POST', '<?php echo WPSG_URL_WP; ?>wp-admin/?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=combination&noheader=1', true);
- request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
- request.onload = () => {
-
- if (request.status >= 200 && request.status < 400) {
-
- const response = JSON.parse(request.responseText);
-
- cb_success(response);
-
- } else {
-
- console.error('Error: ' + request.statusText);
-
- }
-
- };
-
- request.onerror = function() {
-
- console.error('Error: ' + request.statusText);
-
- };
-
- request.send(JSON.stringify(data));
-
- };
- const save = (combination) => {
-
- xhr('save', {
- var_key: combination.var_key,
- product_id: combination.product_id,
- combination: combination
- }, (response) => {
-
- for (let i = 0; i < arPossibleKeys.value.length; i ++) {
-
- const var_key = arPossibleKeys.value[i];
-
- if (var_key.var_key === response.combination.var_key) {
-
- arPossibleKeys.value[i] = response.combination;
-
- }
-
- }
-
- });
-
- combination.loading = true;
-
- }
- const add = (combination) => {
-
- combination.loaded = true;
- combination.loading = true;
-
- xhr('add', {
- var_key: combination.var_key,
- product_id: product_id.value
- }, (response) => {
-
- for (let i = 0; i < arPossibleKeys.value.length; i ++) {
-
- const var_key = arPossibleKeys.value[i];
-
- if (var_key.var_key === response.combination.var_key) {
-
- arPossibleKeys.value[i] = response.combination;
-
- }
-
- }
-
- });
-
- };
- const edit = (combination) => {
-
- combination.loaded = true;
- combination.loading = true;
-
- xhr('edit', {
- var_key: combination.var_key,
- product_id: product_id.value
- }, (response) => {
-
- for (let i = 0; i < arPossibleKeys.value.length; i ++) {
-
- const var_key = arPossibleKeys.value[i];
-
- if (var_key.var_key === response.combination.var_key) {
-
- arPossibleKeys.value[i] = response.combination;
-
- }
-
- }
-
- });
-
- }
-
- return {
- arFilter, arPossibleKeys, arVariant, arVariantLabel, arVariationen, arVariationLabel, product_id,
- getVariantLabel, getVariationLabel,
- arPossibleKeysFiltered,
- add, edit, save
- };
-
- }
- }).mount('#wpsg_mod_productvars_combination');
-
-</script>
-
-<style>
-
- #wpsg_mod_productvars_combination { width:100%; }
- #wpsg_mod_productvars_combination .top_filter { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); row-gap:1rem; column-gap:1rem; margin-bottom:2rem; }
- #wpsg_mod_productvars_combination .top_filter select { width:100%; }
- #wpsg_mod_productvars_combination .panel-title { display:flex; justify-content:space-between; align-items:center; }
- #wpsg_mod_productvars_combination .panel-title .glyphicon { cursor:pointer; }
- #wpsg_mod_productvars_combination .panel { margin-bottom:10px; }
- #wpsg_mod_productvars_combination .loading_layer { z-index:10; position:absolute; left:0; top:0; width:100%; height:100%; background-color:rgba(0, 0, 0, 0.5); display:flex; justify-content:center; align-items:center; }
- #wpsg_mod_productvars_combination .flex { display:flex; }
- #wpsg_mod_productvars_combination .w-full { width:100%; }
- #wpsg_mod_productvars_combination .justify-end { justify-content:flex-end; }
- #wpsg_mod_productvars_combination .mt-4 { margin-top:1rem; }
- #wpsg_mod_productvars_combination .relative { position:relative; }
- #wpsg_mod_productvars_combination .mt-8 { margin-top:2rem; }
-
-</style> \ No newline at end of file
diff --git a/views/mods/mod_produktartikel/produkt_edit_allgemein.phtml b/views/mods/mod_produktartikel/produkt_edit_allgemein.phtml
index 5b0359b..e4a96d6 100644
--- a/views/mods/mod_produktartikel/produkt_edit_allgemein.phtml
+++ b/views/mods/mod_produktartikel/produkt_edit_allgemein.phtml
@@ -8,10 +8,3 @@
?>
<?php echo wpsg_drawForm_Input('wpsg_mod_produktartikel[path]', __('URL Path Segment', 'wpsg'), wpsg_getStr($this->view['data']['post_name']), array('help' => 'wpsg_mod_produktartikel_url_path_seg')); ?>
-<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_ean'))) { ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_produktartikel[ean]', __('EAN', 'wpsg'), wpsg_getStr($this->view['data']['ean']), array('help' => 'wpsg_mod_produktartikel_ean')); ?>
-<?php } ?>
-
-<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_gtin'))) { ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_produktartikel[gtin]', __('GTIN', 'wpsg'), wpsg_getStr($this->view['data']['gtin']), array('help' => 'wpsg_mod_produktartikel_gtin')); ?>
-<?php } ?> \ No newline at end of file
diff --git a/views/mods/mod_produktartikel/settings_edit.phtml b/views/mods/mod_produktartikel/settings_edit.phtml
index 604cd27..02b27dd 100644
--- a/views/mods/mod_produktartikel/settings_edit.phtml
+++ b/views/mods/mod_produktartikel/settings_edit.phtml
@@ -21,11 +21,6 @@
<br />
-<?php echo wpsg_drawForm_Checkbox('wpsg_mod_produktartikel_ean', __('Darstellung der EAN aktivieren', 'wpsg'), $this->get_option('wpsg_mod_produktartikel_ean'), array('help' => 'wpsg_mod_produktartikel_ean')); ?>
-<?php echo wpsg_drawForm_Checkbox('wpsg_mod_produktartikel_gtin', __('Darstellung der GTIN aktivieren', 'wpsg'), $this->get_option('wpsg_mod_produktartikel_gtin'), array('help' => 'wpsg_mod_produktartikel_gtin')); ?>
-
-<br />
-
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_produktartikel_cat', __('Kategorie in Produktübersicht (Backend) anzeigen', 'wpsg'), $this->get_option('wpsg_mod_produktartikel_cat'), array('help' => 'wpsg_mod_produktartikel_cat')); ?>
<div id="wpsg_mod_produktartikel_cat_1">
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_produktartikel_cat_first_level', __('Nur erste Ebene', 'wpsg'), $this->get_option('wpsg_mod_produktartikel_cat_first_level'), array('help' => 'wpsg_mod_produktartikel_cat_first_level')); ?>
diff --git a/views/mods/mod_rechnungen/multi_invoice_pdf.phtml b/views/mods/mod_rechnungen/multi_invoice_pdf.phtml
index fcad732..f3d48e8 100644
--- a/views/mods/mod_rechnungen/multi_invoice_pdf.phtml
+++ b/views/mods/mod_rechnungen/multi_invoice_pdf.phtml
@@ -286,7 +286,7 @@
if ($this->get_option('wpsg_mod_rechnungen_anr') == '1') {
- $pdf->Cell(10, 8, $oOrderProduct->getProduct()->getProductNr(), 0, 0, 'C');
+ $pdf->Cell(10, 8, $oOrderProduct->getProduct()->getNr(), 0, 0, 'C');
} else {
diff --git a/views/produkt/addedit_productcodes.phtml b/views/produkt/addedit_productcodes.phtml
new file mode 100644
index 0000000..602a9b5
--- /dev/null
+++ b/views/produkt/addedit_productcodes.phtml
@@ -0,0 +1,65 @@
+<?php
+
+ declare(strict_types=1);
+
+ /**
+ * Template für die Anzeige der Produktcodes
+ * @author: Daniel Schmitzer (daschmi@daschmi.de)
+ * @date: 24.04.23
+ * @time: 13:16
+ */
+
+ namespace wpsg;
+
+?>
+
+<div class="general-panel-block">
+ <div class="general-panel-general">
+ <?php echo wpsg_drawForm_AdminboxStart(__('Productcodes', 'wpsg')); ?>
+
+ <?php if (intval($this->view['data']['id']) > 0) {
+
+ /** @var \wpsg_product $oProduct */
+ $oProduct = \wpsg_product::getInstance(intval($this->view['data']['id']));
+
+ ?>
+
+ <?php echo wpsg_drawForm_Select('meta[code_mode]', __('Modus', 'wpsg'), [
+ '0' => __('Erster definierter Code', 'wpsg'),
+ 'ean' => __('EAN als Standard', 'wpsg'),
+ 'gtin' => __('GTIN als Standard', 'wpsg'),
+ 'mpn' => __('MPN als Standard', 'wpsg'),
+ 'pzn' => __('PZN als Standard', 'wpsg'),
+ 'sku' => __('SKU als Standard', 'wpsg'),
+ 'upc' => __('UPC als Standard', 'wpsg'),
+ 'isbn' => __('ISBN als Standard', 'wpsg'),
+ 'issn' => __('ISSN als Standard', 'wpsg'),
+ 'isin' => __('ISIN als Standard', 'wpsg')
+ ], $oProduct->getMeta('code_mode', false, '0'), ['help' => 'code_mode']); ?>
+ <?php echo wpsg_drawForm_Input('meta[ean]', __('EAN', 'wpsg'), $oProduct->getMeta('ean'), ['help' => 'ean']); ?>
+ <?php echo wpsg_drawForm_Input('meta[gtin]', __('GTIN', 'wpsg'), $oProduct->getMeta('gtin'), ['help' => 'gtin']); ?>
+ <?php echo wpsg_drawForm_Input('meta[mpn]', __('MPN', 'wpsg'), $oProduct->getMeta('mpn'), ['help' => 'mpn']); ?>
+ <?php echo wpsg_drawForm_Input('meta[pzn]', __('PZN', 'wpsg'), $oProduct->getMeta('pzn'), ['help' => 'pzn']); ?>
+ <?php echo wpsg_drawForm_Input('meta[sku]', __('SKU', 'wpsg'), $oProduct->getMeta('sku'), ['help' => 'sku']); ?>
+ <?php echo wpsg_drawForm_Input('meta[upc]', __('UPC', 'wpsg'), $oProduct->getMeta('upc'), ['help' => 'upc']); ?>
+ <?php echo wpsg_drawForm_Input('meta[isbn]', __('ISBN', 'wpsg'), $oProduct->getMeta('isbn'), ['help' => 'isbn']); ?>
+ <?php echo wpsg_drawForm_Input('meta[issn]', __('ISSN', 'wpsg'), $oProduct->getMeta('issn'), ['help' => 'issn']); ?>
+ <?php echo wpsg_drawForm_Input('meta[isin]', __('ISIN', 'wpsg'), $oProduct->getMeta('isin'), ['help' => 'isin']); ?>
+
+ <?php if (\wpsg_ShopController::getShop()->hasMod('wpsg_mod_productvariants')) { ?>
+
+ <br />
+
+ <p class="wpsg_hinweis">Ist das Produkt ein Variantenprodukt, können die Codes unter Produktvarianten für einzelne Variationen überschrieben werden.</p>
+
+ <?php } ?>
+
+ <?php } else { ?>
+
+ <p><?php echo __('Bitte Produkt erst speichern.', 'wpsg'); ?></p>
+
+ <?php } ?>
+
+ <?php echo wpsg_drawForm_AdminboxEnd(); ?>
+ </div>
+</div>
diff --git a/views/produkt/index.phtml b/views/produkt/index.phtml
index 9a11630..825bfe4 100644
--- a/views/produkt/index.phtml
+++ b/views/produkt/index.phtml
@@ -201,14 +201,6 @@
<th class="wpsg_order" data-order="cat"><?php echo __('Kategorie', 'wpsg'); ?></th>
<?php } ?>
- <?php if ($this->hasMod('wpsg_mod_produktartikel') && $this->get_option('wpsg_mod_produktartikel_gtin') == '1') { ?>
- <th class="wpsg_order" data-order="gtin-nr"><?php echo __("GTIN", "wpsg"); ?></th>
- <?php } ?>
-
- <?php if ($this->hasMod('wpsg_mod_produktartikel') && $this->get_option('wpsg_mod_produktartikel_ean') == '1') { ?>
- <th class="wpsg_order" data-order="ean-nr"><?php echo __("EAN", "wpsg"); ?></th>
- <?php } ?>
-
<?php if ($this->hasMod('wpsg_mod_deliverytime') && $this->get_option('wpsg_mod_deliverytime_productindex') == '1') { ?>
<th class="wpsg_order" data-order="deliverytime"><?php echo __("Lieferzeit", 'wpsg'); ?></th>
<?php } ?>
@@ -336,12 +328,6 @@
?>
</td>
<?php } ?>
- <?php if ($this->hasMod('wpsg_mod_produktartikel') && $this->get_option('wpsg_mod_produktartikel_gtin') == '1') { ?>
- <td><?php echo wpsg_hspc($d['gtin']); ?></td>
- <?php } ?>
- <?php if ($this->hasMod('wpsg_mod_produktartikel') && $this->get_option('wpsg_mod_produktartikel_ean') == '1') { ?>
- <td><?php echo wpsg_hspc($d['ean']); ?></td>
- <?php } ?>
<?php if ($this->hasMod('wpsg_mod_deliverytime') && $this->get_option('wpsg_mod_deliverytime_productindex') == '1') { ?>
<td>
<?php if ($this->callMod('wpsg_mod_deliverytime', 'isStoreProduct', array($oProduct->getProductKey()))) { ?>
diff --git a/views/produkttemplates/standard.phtml b/views/produkttemplates/standard.phtml
index 4dc17a4..e64a94e 100644
--- a/views/produkttemplates/standard.phtml
+++ b/views/produkttemplates/standard.phtml
@@ -19,7 +19,7 @@
<input type="hidden" name="wpsg_post_id" value="<?php echo get_the_ID(); ?>" />
<input type="hidden" name="titleDisplayed" value="<?php echo $this->titleDisplayed; ?>" />
-
+
<div class="wpsg_produkt wpsg_product_name">
<?php if (!$this->titleDisplayed) { ?>
@@ -35,11 +35,15 @@
<div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
- <meta itemprop="name" content="<?php echo wpsg_hspc($this->getProductName($this->view['data']['id'])); ?>" />
- <meta itemprop="sku" content="<?php echo wpsg_hspc($oProduct->getProductNr()); ?>" />
- <meta itemprop="gtin13" content="<?php echo wpsg_hspc($oProduct->getEAN()); ?>" />
- <meta itemprop="detailname" content="<?php echo wpsg_hspc($this->view['data']['detailname']); ?>" />
-
+ <meta itemprop="name" content="<?php echo wpsg_hspc($this->getProductName($this->view['data']['id'])); ?>" />
+ <meta itemprop="detailname" content="<?php echo wpsg_hspc($this->view['data']['detailname']); ?>" />
+
+ <?php foreach ($oProduct->getAllProductCodes() as $product_code) { ?>
+ <?php if ($product_code['itemprop'] !== null) { ?>
+ <meta itemprop="<?php echo $product_code['itemprop']; ?>" content="<?php echo $product_code['code']; ?>" />
+ <?php } ?>
+ <?php } ?>
+
<?php /* Block für die Produktbilder START */ ?>
<?php
@@ -79,13 +83,23 @@
<?php if ($this->get_option('wpsg_showArticelnumber') == '1') { ?>
<div class="wpsg_artikelnummer">
- <?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($this->view['data']['anr']); ?></span><br />
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_ean'))) {?>
- <?php echo __('EAN','wpsg');?>:<span class="wpsg_ean"><?php echo wpsg_hspc($this->view['data']['ean']); ?></span><br />
+ <?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($oProduct->getNr()); ?></span><br />
+ </div>
+ <?php } ?>
+
+ <?php $arProductCodes = $oProduct->getAllProductCodes(); ?>
+ <?php if (sizeof($arProductCodes) > 0) { ?>
+ <div class="product_code_wrap">
+ <?php foreach ($arProductCodes as $product_code) { ?>
+ <?php if ($product_code !== null) { ?>
+
+ <div class="product_code <?php echo $product_code['code_key']; ?>">
+ <span class="label"><?php echo $product_code['label']; ?></span>: <span class="code"><?php echo $product_code['code']; ?></span>
+ </div>
+
+ <?php } ?>
<?php } ?>
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_gtin'))) {?>
- <?php echo __('GTIN','wpsg');?>:<span class="wpsg_gtin"><?php echo wpsg_hspc($this->view['data']['gtin']); ?></span><br />
- <?php }?></div>
+ </div>
<?php } ?>
<?php /* Abfrage Preisanzeige nur für eingeloggte User aktiv und User eingeloggt START*/ ?>
@@ -164,7 +178,7 @@
<?php }?>
<?php /* Abfrage Preisanzeige nur für eingeloggte User aktiv und User eingeloggt ENDE */ ?>
-
+
<div itemprop="description" class="wpsg_produkt_shortdescription">
<span><?php echo $this->view['data']['shortdesc']; ?></span>
diff --git a/views/produkttemplates/standard2.phtml b/views/produkttemplates/standard2.phtml
index 5658288..8db4bed 100644
--- a/views/produkttemplates/standard2.phtml
+++ b/views/produkttemplates/standard2.phtml
@@ -10,6 +10,7 @@
// Damit keine Zubehörprodukte ausgegeben werden
//$this->noReleatedProducts = true;
+ /** @var wpsg_product $oProduct */
$oProduct = $this->view['oProduct'];
$var_info = [];
@@ -85,13 +86,23 @@
<?php if ($this->get_option('wpsg_showArticelnumber') == '1') { ?>
<div class="wpsg_artikelnummer">
- <?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($this->view['data']['anr']); ?></span><br />
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_ean'))) {?>
- <?php echo __('EAN','wpsg');?>:<span class="wpsg_ean"><?php echo wpsg_hspc($this->view['data']['ean']); ?></span><br />
+ <?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($oProduct->getNr()); ?></span><br />
+ </div>
+ <?php } ?>
+
+ <?php $arProductCodes = $oProduct->getAllProductCodes(); ?>
+ <?php if (sizeof($arProductCodes) > 0) { ?>
+ <div class="product_code_wrap">
+ <?php foreach ($arProductCodes as $product_code) { ?>
+ <?php if ($product_code !== null) { ?>
+
+ <div class="product_code <?php echo $product_code['code_key']; ?>">
+ <span class="label"><?php echo $product_code['label']; ?></span>: <span class="code"><?php echo $product_code['code']; ?></span>
+ </div>
+
+ <?php } ?>
<?php } ?>
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_gtin'))) {?>
- <?php echo __('GTIN','wpsg');?>:<span class="wpsg_gtin"><?php echo wpsg_hspc($this->view['data']['gtin']); ?></span><br />
- <?php }?></div>
+ </div>
<?php } ?>
<?php /* Abfrage Preisanzeige nur für eingeloggte User aktiv und User eingeloggt START*/ ?>
diff --git a/views/produkttemplates/standard3.phtml b/views/produkttemplates/standard3.phtml
index 285d51e..a617630 100644
--- a/views/produkttemplates/standard3.phtml
+++ b/views/produkttemplates/standard3.phtml
@@ -69,15 +69,24 @@
<?php if ($this->get_option('wpsg_showArticelnumber') == '1') { ?>
<div class="wpsg_artikelnummer">
- <?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($this->view['data']['anr']); ?></span><br />
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_ean'))) {?>
- <?php echo __('EAN','wpsg');?>:<span class="wpsg_ean"><?php echo wpsg_hspc($this->view['data']['ean']); ?></span><br />
- <?php } ?>
- <?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_gtin'))) {?>
- <?php echo __('GTIN','wpsg');?>:<span class="wpsg_gtin"><?php echo wpsg_hspc($this->view['data']['gtin']); ?></span><br />
- <?php }?>
- </div>
- <?php } ?>
+ <?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($oProduct->getNr()); ?></span><br />
+ </div>
+ <?php } ?>
+
+ <?php $arProductCodes = $oProduct->getAllProductCodes(); ?>
+ <?php if (sizeof($arProductCodes) > 0) { ?>
+ <div class="product_code_wrap">
+ <?php foreach ($arProductCodes as $product_code) { ?>
+ <?php if ($product_code !== null) { ?>
+
+ <div class="product_code <?php echo $product_code['code_key']; ?>">
+ <span class="label"><?php echo $product_code['label']; ?></span>: <span class="code"><?php echo $product_code['code']; ?></span>
+ </div>
+
+ <?php } ?>
+ <?php } ?>
+ </div>
+ <?php } ?>
<?php /* Abfrage Preisanzeige nur für eingeloggte User aktiv und User eingeloggt START*/ ?>
<?php if ($this->view['oProduct']->canDisplayPrice()) { ?>