diff options
Diffstat (limited to 'views')
| -rw-r--r-- | views/css/admin.css | 5 | ||||
| -rw-r--r-- | views/mods/mod_downloadplus/settings_edit_templates.phtml | 20 | ||||
| -rw-r--r-- | views/mods/mod_productgroups/list.phtml | 36 | ||||
| -rw-r--r-- | views/mods/mod_productindex/layouts/list.phtml | 2 | ||||
| -rw-r--r-- | views/mods/mod_productvariants/admin_edit.phtml | 184 | ||||
| -rw-r--r-- | views/mods/mod_productvariants/admin_html.phtml | 9 | ||||
| -rw-r--r-- | views/mods/mod_productvariants/admin_show.phtml | 8 | ||||
| -rw-r--r-- | views/produkttemplates/standard.phtml | 2 |
8 files changed, 218 insertions, 48 deletions
diff --git a/views/css/admin.css b/views/css/admin.css index fab0761..cfd6d28 100644 --- a/views/css/admin.css +++ b/views/css/admin.css @@ -66,6 +66,7 @@ #wpsg-bs .wpsg-wp-header-end { margin-top:-10px !important; }
#wpsg-bs .wpsg_msg_wrap { margin-right:20px; }
#wpsg-bs .d-flex { display:flex; }
+#wpsg-bs .justify-content-between { justify-content:space-between; }
#wpsg-bs .w-100 { width:100%; }
#wpsg-bs .justify-content_center { justify-content:center; }
#wpsg-bs .align-items_center { align-items:center; }
@@ -385,6 +386,10 @@ .wpsg_mod_productvariants_table_variants .col_type { width:100px; }
.wpsg_mod_productvariants_table_variants .col_id { width:50px; }
.wpsg_mod_productvariants_table_variation .col_action { text-align:right; width:75px; }
+.wpsg_mod_productvariants_table_variation .wpsg_mod_productvariants_remove_global_vari_image { position:relative; text-decoration:none; display:inline-block; }
+.wpsg_mod_productvariants_table_variation .wpsg_mod_productvariants_remove_global_vari_image > span { color:#FFFFFF; background-color:rgba(0, 0, 0, 0.5); position:absolute; left:0; top:0; width:100%; height:100%; display:none; justify-content:center; align-items:center; }
+.wpsg_mod_productvariants_table_variation .wpsg_mod_productvariants_remove_global_vari_image:hover > span { display:flex; }
+.wpsg_mod_productvariants_table_variation .wpsg_mod_productvariants_remove_global_vari_image img { max-width:25px; max-height:25px; }
.wpsg_mod_productvariants_table_variation tbody:nth-child(even) td { background-color:#F9F9F9; }
.wpsg_mod_productvariants_table_variation .col_id { width:50px; }
.wpsg_mod_productvariants_table_variation .col_active { width:25px; }
diff --git a/views/mods/mod_downloadplus/settings_edit_templates.phtml b/views/mods/mod_downloadplus/settings_edit_templates.phtml index 498aed4..a3e97ee 100644 --- a/views/mods/mod_downloadplus/settings_edit_templates.phtml +++ b/views/mods/mod_downloadplus/settings_edit_templates.phtml @@ -46,7 +46,10 @@ <div v-if="template" class="template">
<div class="form-group form-group-sm has-feedback">
- <label class="col-sm-6 control-label" for="wpsg_mod_downloadplus_filename"><?php echo __('Name des Templates', 'wpsg'); ?></label>
+ <label class="col-sm-6 control-label label-copy" for="wpsg_mod_downloadplus_filename">
+ <a href="#" title="<?php echo __('Template kopieren', 'wpsg'); ?>" @click="copyTemplate()"><span class="wpsg-glyphicon glyphicon glyphicon-copy"></span></a>
+ <span><?php echo __('Name des Templates', 'wpsg'); ?></span>
+ </label>
<div class="col-sm-6">
<div class="wpsg_field_wrap wpsg_field_wrap_template_name">
<input type="text" v-model="template.name" />
@@ -179,6 +182,8 @@ #wpsg_dp_templates_app .file_wrap { display:flex; justify-content:space-between; align-items:center; }
#wpsg_dp_templates_app .file_wrap .file { display:flex; gap:1rem; justify-content:flex-end; align-items:center; }
#wpsg_dp_templates_app .file_wrap .file .wpsg-glyphicon { margin-right:8px; }
+ #wpsg_dp_templates_app .label-copy { display:flex; justify-content:space-between; }
+ #wpsg_dp_templates_app .label-copy .glyphicon { font-size:14px; }
</style>
@@ -220,6 +225,19 @@ },
+ copyTemplate: function() {
+
+ if (!confirm('<?php echo __('Sind Sie sich sicher, dass sie das Template kopieren möchten?', 'wpsg'); ?>')) return false;
+
+ let new_template = JSON.parse(JSON.stringify(this.template));
+
+ new_template.name += ' (Kopie)';
+
+ this.arTemplates.push(new_template);
+ this.template = new_template;
+
+ },
+
removeTemplate: function() {
if (!confirm('<?php echo __('Sind Sie sich sicher? Das ganze Template und alle Felder werden gelöscht.', 'wpsg'); ?>')) return;
diff --git a/views/mods/mod_productgroups/list.phtml b/views/mods/mod_productgroups/list.phtml index 3491629..07df917 100644 --- a/views/mods/mod_productgroups/list.phtml +++ b/views/mods/mod_productgroups/list.phtml @@ -21,16 +21,32 @@ </div>
<div class="wpsg_pgruppen_list_produkte">
<?php for ($i = 0; $i < $showP && $i < sizeof($g['produkte']); $i ++) { ?>
- <?php $image = array_rand($g['produkte'][$i]['bilder']); ?>
- <?php if ($image >= 0 && is_int($image)) { ?>
- <div class="wpsg_pgruppen_list_image">
-
- <a href="<?php echo $g['produkte'][$i]['url'] ?>">
- <?php echo wp_get_attachment_image($g['produkte'][$i]['bilder'][0], 'thumbnail', false, array()); ?>
- </a>
-
- </div>
- <?php } ?>
+
+ <?
+
+ $lagerbestand = $this->callMod('wpsg_mod_stock', 'getBestand', [$g['produkte'][$i]['id']]);
+
+ ?>
+
+ <?php if ($lagerbestand <= 0) { ?>
+
+ Ausverkauft ...
+
+ <?php } else { ?>
+
+ <?php $image = array_rand($g['produkte'][$i]['bilder']); ?>
+ <?php if ($image >= 0 && is_int($image)) { ?>
+ <div class="wpsg_pgruppen_list_image">
+
+ <a href="<?php echo $g['produkte'][$i]['url'] ?>">
+ <?php echo wp_get_attachment_image($g['produkte'][$i]['bilder'][0], 'thumbnail', false, array()); ?>
+ </a>
+
+ </div>
+ <?php } ?>
+
+ <?php } ?>
+
<?php } ?>
<div style="clear:both;"></div>
</div>
diff --git a/views/mods/mod_productindex/layouts/list.phtml b/views/mods/mod_productindex/layouts/list.phtml index fa1eb24..4200544 100644 --- a/views/mods/mod_productindex/layouts/list.phtml +++ b/views/mods/mod_productindex/layouts/list.phtml @@ -101,7 +101,7 @@ </div>
<div class="wpsg_mod_productindex_fmenge">
- <?php if ($this->hasMod('wpsg_mod_fuellmenge') && $this->get_option('wpsg_mod_fuellmenge_showProductindex_fmenge') == '1') { ?>
+ <?php if ($this->hasMod('wpsg_mod_fuellmenge') && $this->get_option('wpsg_mod_fuellmenge_showProductindex_fmenge') == '1') { ?>
<?php if (($p['fmenge']) > '0') { ?>
<?php echo wpsg_translate(__('Füllmenge: #1#', 'wpsg'), wpsg_ff($p['fmenge'], $p['feinheit'])); ?>
<br />
diff --git a/views/mods/mod_productvariants/admin_edit.phtml b/views/mods/mod_productvariants/admin_edit.phtml index 5b4722e..02d00bb 100644 --- a/views/mods/mod_productvariants/admin_edit.phtml +++ b/views/mods/mod_productvariants/admin_edit.phtml @@ -5,10 +5,22 @@ */
?>
-
+
<input type="hidden" id="wpsg_mod_productvariants_product_id" value="<?php echo $this->view['product_id']; ?>" />
<input type="hidden" id="wpsg_mod_productvariants_var_id" value="<?php echo $this->view['variant']['id']; ?>" />
+<script>
+
+ var wpframe; var wpsg_mod_productvariants_vari_id = 0;
+ var metaBox = jQuery('#meta-box-id.postbox');
+
+ var addImgLink = metaBox.find('.upload-custom-img');
+ var delImgLink = metaBox.find('.delete-custom-img');
+ var imgContainer = metaBox.find('.custom-img-container');
+ var imgIdInput = metaBox.find('.custom-img-id');
+
+</script>
+
<?php if (wpsg_isSizedArray($this->view['arVariation'])) { ?>
<table class="table wpsg_mod_productvariants_table_variation">
@@ -49,7 +61,11 @@ </tr>
</thead>
- <?php $i = 0; foreach ($this->view['arVariation'] as $vari) { $i ++; ?>
+ <?php $i = 0; foreach ($this->view['arVariation'] as $vari) { $i ++;
+
+ $vari_id = intval($vari['id']);
+
+ ?>
<tbody id="vari_<?php echo $vari['id']; ?>">
<tr>
@@ -180,31 +196,122 @@ <?php } ?>
</tr>
-
- <?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
+
<tr class="wpsg_mod_productvariants_productimage_row">
<td class="col_active"> </td>
<?php
-
- $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
+
+ if (wpsg_isSizedInt($this->view['product_id'])) {
+
+ $arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
+
+ } else {
+
+ $vari_images = $this->get_option('wpsg_mod_productvariants_global_images');
+ if (!is_array($vari_images)) $vari_images = [];
+
+ $arAttachmentIDs = ((isset($vari_images[$vari_id]))?$vari_images[$vari_id]:[]);
+
+ }
?>
<td class="ui-sortable" colspan="<?php echo $colspan; ?>" id="wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>" >
-
- <?php foreach ($arAttachmentIDs as $attachment_id) { ?>
-
- <a href="#" class="<?php echo ((in_array($attachment_id, explode(",", $vari['images_set'])))?'mark':''); ?> pic" id="<?php echo $attachment_id; ?>" onclick="return wpsg_vp_vari_setPic(this, <?php echo $this->view['variant']['id']; ?>, <?php echo $vari['id'] ?>, '<?php echo $attachment_id; ?>', <?php echo $this->view['product_id']; ?>);">
-
- <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
-
- </a>
-
- <?php } ?>
+
+ <div class="d-flex justify-content-between w-100">
+
+ <div>
+ <?php foreach ($arAttachmentIDs as $attachment_id) { $attachment_id = intval($attachment_id); ?>
+
+ <?php if (wpsg_isSizedInt($this->view['product_id'])) { ?>
+
+ <a href="#" class="<?php echo ((in_array($attachment_id, explode(",", $vari['images_set'])))?'mark':''); ?> pic" id="<?php echo $attachment_id; ?>" onclick="return wpsg_vp_vari_setPic(this, <?php echo $this->view['variant']['id']; ?>, <?php echo $vari['id'] ?>, '<?php echo $attachment_id; ?>', <?php echo $this->view['product_id']; ?>);">
+ <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
+ </a>
+
+ <?php } else { ?>
+
+ <a href="#" class="pic wpsg_mod_productvariants_remove_global_vari_image"
+ data-variant_id="<?php echo intval($_REQUEST['variant_id']); ?>"
+ data-variation_id="<?php echo $vari['id']; ?>"
+ data-attachment_id="<?php echo $attachment_id; ?>"
+ >
+ <?php echo wp_get_attachment_image($attachment_id, array(25, 25), true); ?>
+ <span><span class="glyphicon glyphicon-trash"></span></span>
+ </a>
+
+ <?php } ?>
+
+ <?php } ?>
+ </div>
+
+ <?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
+ <div>
+
+ <input id="media_upload_<?php echo $vari['id']; ?>" value="<?php echo __('Mediathek', 'wpsg'); ?>" class="button" type="button" />
+
+ </div>
+ <?php } ?>
+
+ </div>
- <script type="text/javascript">
+ <script>
jQuery(document).ready(function() {
-
+
+ <?php if (intval($this->view['product_id']) <= 0) { ?>
+ document.getElementById('media_upload_<?php echo $vari['id']; ?>').addEventListener('click', (event) => {
+
+ event.preventDefault();
+
+ wpsg_mod_productvariants_vari_id = <?php echo $vari['id']; ?>;
+
+ if (wpframe !== undefined) { wpframe.open(); return; }
+
+ wpframe = wp.media.frames.file_frame = wp.media({
+ title: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
+ button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
+ multiple: true
+ });
+
+ wpframe.on('select', () => {
+
+ let arAtt = [];
+ let attachments = wpframe.state().get('selection').map((attachment) => {
+
+ attachment.toJSON();
+
+ arAtt.push(attachment.id);
+
+ return attachment;
+
+ });
+
+ jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+ jQuery.ajax({
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_upload&noheader=1',
+ async: true,
+ data: {
+ product_id: '<?php echo intval($_REQUEST['product_id']); ?>',
+ variant_id: '<?php echo intval($_REQUEST['variant_id']); ?>',
+ vari_id: wpsg_mod_productvariants_vari_id,
+ arAtt: arAtt
+ },
+ success: function(data) {
+
+ jQuery('#wpsg_mod_productvariants_dialog_modal .modal-body').html(data);
+
+ }
+ });
+
+ });
+
+ wpframe.open();
+
+ });
+ <?php } ?>
+
+ <?php if (intval($this->view['product_id']) > 0) { ?>
jQuery('#wpsg_images_productimage_<?php echo $this->view['variant']['id']; ?>_<?php echo $vari['id']; ?>').sortable( {
items: 'a',
helper : 'clone',
@@ -232,7 +339,8 @@ } );
}
- } ).disableSelection();
+ } ).disableSelection();
+ <?php } ?>
} );
@@ -241,14 +349,13 @@ </td>
</tr>
- <?php } ?>
</tbody>
<?php } ?>
</table>
- <script type="text/javascript">/* <![CDATA[ */
+ <script>
function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, attachment_id, product_id)
{
@@ -334,8 +441,32 @@ <?php } else { ?>
jQuery('#wpsg_mod_productvariants_variation_add_button').hide();
<?php } ?>
-
- /* ]]> */</script>
+
+ jQuery('.wpsg_mod_productvariants_remove_global_vari_image').on('click', function() {
+
+ let el = jQuery(this);
+
+ event.preventDefault();
+
+ if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return;
+
+ el.remove();
+
+ jQuery.ajax({
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_removeImage&noheader=1',
+ async: true,
+ data: {
+ product_id: 0,
+ variant_id: el.data('variant_id'),
+ vari_id: el.data('variation_id'),
+ attachment_id: el.data('attachment_id')
+ },
+ success: function(data) { }
+ });
+
+ });
+
+ </script>
<?php if (!wpsg_isSizedInt($this->view['product_id'])) { ?>
<p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
@@ -345,7 +476,7 @@ <?php echo __('Bisher keine Variationen der Variante angelegt.', 'wpsg'); ?>
- <script type="text/javascript">/* <![CDATA[ */
+ <script>
<?php if (wpsg_isSizedInt($this->view['variant']['product_id']) || !wpsg_isSizedInt($this->view['product_id'])) { ?>
jQuery('.wpsg_mod_productvariants_variation_add_button').show();
@@ -353,6 +484,7 @@ jQuery('.wpsg_mod_productvariants_variation_add_button').hide();
<?php } ?>
- /* ]]> */</script>
+ </script>
+
+<?php } ?>
-<?php } ?>
\ No newline at end of file diff --git a/views/mods/mod_productvariants/admin_html.phtml b/views/mods/mod_productvariants/admin_html.phtml index 7fc6fe6..dd225e0 100644 --- a/views/mods/mod_productvariants/admin_html.phtml +++ b/views/mods/mod_productvariants/admin_html.phtml @@ -40,7 +40,7 @@ </div>
</div>
-<script type="text/javascript">/* <![CDATA[ */
+<script>
function wpsg_mod_productvariants_del(variant_id)
{
@@ -133,8 +133,7 @@ } // function wpsg_mod_productvariants_edit(variant_id)
- function wpsg_mod_productvariants_variation_add()
- {
+ function wpsg_mod_productvariants_variation_add() {
var variant_id = jQuery('#wpsg_mod_productvariants_var_id').val();
var product_id = jQuery('#wpsg_mod_productvariants_product_id').val();
@@ -163,7 +162,7 @@ return false;
- } // function wpsg_mod_productvariants_variation_add()
+ }
function wpsg_mod_productvariants_add()
{
@@ -269,4 +268,4 @@ } // function wpsg_mod_productvariants_show()
-/* ]]> */</script>
\ No newline at end of file +</script>
\ No newline at end of file diff --git a/views/mods/mod_productvariants/admin_show.phtml b/views/mods/mod_productvariants/admin_show.phtml index 0460d75..c3d7c9a 100644 --- a/views/mods/mod_productvariants/admin_show.phtml +++ b/views/mods/mod_productvariants/admin_show.phtml @@ -47,7 +47,7 @@ <?php } ?>
<td class="col_action">
- <script type="text/javascript">/* <![CDATA[ */
+ <script>
<?php if ((wpsg_isSizedInt($this->view['product_id']) && $this->view['product_id'] == $var['product_id']) || (!wpsg_isSizedInt($var['product_id']) && !wpsg_isSizedInt($this->view['product_id']))) { ?>
@@ -69,7 +69,7 @@ <?php } ?>
- /* ]]> */</script>
+ </script>
<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Variante bearbeiten', 'wpsg'); ?>" onclick="return wpsg_mod_productvariants_edit(<?php echo $var['id']; ?>);"><span class="glyphicon glyphicon-pencil"></span></a>
@@ -85,7 +85,7 @@ <p class="wpsg_hinweis"><?php echo __('Reihenfolge kann mittels Drag&Drop verändert werden.', 'wpsg'); ?></p>
- <script>/* <![CDATA[ */
+ <script>
jQuery('.wpsg_mod_productvariants_table_variants tbody').sortable( {
items: 'tr',
@@ -108,7 +108,7 @@ }
} );
- /* ]]> */</script>
+ </script>
<?php } else { ?>
<?php echo __('Bisher keine Produktvarianten angelegt.', 'wpsg'); ?>
diff --git a/views/produkttemplates/standard.phtml b/views/produkttemplates/standard.phtml index bdcf3ba..718f8f9 100644 --- a/views/produkttemplates/standard.phtml +++ b/views/produkttemplates/standard.phtml @@ -43,7 +43,7 @@ /* Array mit allen AttachmentIDs der Produktbilder */
$arAttachmentIDsAll = $this->imagehandler->getAttachmentIDs($this->view['data']['product_id']);
-
+
?>
<?php if (wpsg_isSizedArray($arAttachmentIDsAll)) { ?>
|
