summaryrefslogtreecommitdiff
path: root/views/mods/mod_productview
diff options
context:
space:
mode:
Diffstat (limited to 'views/mods/mod_productview')
-rw-r--r--views/mods/mod_productview/productview.js78
-rw-r--r--views/mods/mod_productview/productview.phtml21
-rw-r--r--views/mods/mod_productview/productview_filter.phtml135
-rw-r--r--views/mods/mod_productview/settings_edit.phtml3
4 files changed, 210 insertions, 27 deletions
diff --git a/views/mods/mod_productview/productview.js b/views/mods/mod_productview/productview.js
index d80dc83..7a30c02 100644
--- a/views/mods/mod_productview/productview.js
+++ b/views/mods/mod_productview/productview.js
@@ -5,8 +5,9 @@
var atts = jQuery.parseJSON(jQuery('#wpsg_productview_' + index + ' input[name="wpsg_atts"]').val());
atts.page = page;
- atts.order = order;
- atts.mode = mode;
+
+ if (typeof order !== "undefined") atts.order = order;
+ if (typeof mode !== "undefined") atts.mode = mode;
if (jQuery('#wpsg_mod_productview_filter').length > 0)
{
@@ -42,14 +43,61 @@
var max_height = 0; jQuery('#wpsg_productview_' + index + ' .wpsg_mod_productview_name').each(function() { if (jQuery(this).outerHeight() > max_height) max_height = jQuery(this).outerHeight(); } ).outerHeight(max_height);
var max_height = 0; jQuery('#wpsg_productview_' + index + ' .wpsg_mod_productview_description').each(function() { if (jQuery(this).outerHeight() > max_height) max_height = jQuery(this).outerHeight(); } ).outerHeight(max_height);
+ // Sortierungslayer
+ jQuery('.wpsg_mod_productview-order').bind('click', function(event) {
+
+ if (jQuery(this).find('.wpsg_mod_productview-order-layer').is(':visible'))
+ {
+
+ jQuery(this).find('.wpsg_mod_productview-order-layer').slideUp();
+
+ }
+ else
+ {
+
+ jQuery(this).find('.wpsg_mod_productview-order-layer').slideDown();
+
+ }
+
+ event.stopPropagation();
+
+ } ).disableSelection();
+
+ // Sortierung
+ jQuery('.wpsg_mod_productview-order-layer a').bind('click', function() {
+
+ var productview_index = jQuery(this).attr("data-productview-index");
+ var order = jQuery(this).attr("data-order");
+
+ wpsg_switchProductview(productview_index, 1, order);
+
+ return false;
+
+ } ).disableSelection();
+
+ }
+
+ function wpsg_filter_insert(values, set)
+ {
+
+ var arValues = [];
+
+ if (jQuery.trim(values) != '') arValues = jQuery.trim(values).split(',');
+
+ if (jQuery.inArray(set, arValues) >= 0) arValues = jQuery.grep(arValues, function(value) { return value != set; } );
+ else arValues.push(set);
+
+ return jQuery.unique(arValues).join(',');
+
}
jQuery(document).ready(function() {
+ // Preisfilter
var filter_min = parseFloat(jQuery('#wpsg_mod_productview_filter_price_info input[name="price_min"]').val());
var filter_max = parseFloat(jQuery('#wpsg_mod_productview_filter_price_info input[name="price_max"]').val());
-
- jQuery("#wpsg_mod_productview_filter_price-range").slider( {
+
+ jQuery("#wpsg_mod_productview_filter_price-range").slider( {
range: true,
min: filter_min,
max: filter_max,
@@ -69,7 +117,21 @@
}
} );
-
+
+ // Variantenfilter Small
+ jQuery('.wpsg_mod_productview_filter_item a.switch').bind('click', function() {
+
+ var input = jQuery(this).parents('.wpsg_mod_productview_filter_item').find('input.val');
+ input.val(wpsg_filter_insert(input.val(), jQuery(this).attr('data-value')));
+
+ jQuery(this).toggleClass('active');
+
+ wpsg_switchProductview(1, 1);
+
+ return false;
+
+ } );
+
jQuery('.wpsg_productview').each(function() {
var x = jQuery(this).attr("id").substr(17);
@@ -77,5 +139,11 @@
} );
+ jQuery('body, html').bind('click', function() {
+
+ jQuery('.wpsg_mod_productview-order-layer:visible').each(function() { jQuery(this).parent().click(); } );
+
+ } );
+
} );
\ No newline at end of file
diff --git a/views/mods/mod_productview/productview.phtml b/views/mods/mod_productview/productview.phtml
index e643db7..c98b4b3 100644
--- a/views/mods/mod_productview/productview.phtml
+++ b/views/mods/mod_productview/productview.phtml
@@ -18,17 +18,30 @@
<?php if (wpsg_isSizedArray($this->view['wpsg_mod_productview']['products'])) { ?>
<div class="wpsg_mod_productview-order <?php echo $this->view['wpsg_mod_productview']['col_class']['order']; ?>">
- <?php echo __('Sortierung', 'wpsg'); ?><span class="glyphicon glyphicon-menu-down"></span>
- <strong>Neueste zuerst</strong>
+ <?php echo __('Sortierung', 'wpsg'); $order = $this->view['wpsg_mod_productview']['order']; ?>
+ <?php if (substr($order, -3) === 'asc') { ?>
+ <span class="glyphicon glyphicon-menu-up"></span>
+ <?php } else { ?>
+ <span class="glyphicon glyphicon-menu-down"></span>
+ <?php } ?>
+
+ <strong><?php echo $this->view['wpsg_mod_productview']['arOrder'][$order]; ?></strong>
+ <div class="wpsg_mod_productview-order-layer">
+ <div class="inner">
+ <?php foreach ($this->view['wpsg_mod_productview']['arOrder'] as $value => $label) { ?>
+ <a href="#" class="<?php echo (($this->view['wpsg_mod_productview']['order'] === $value)?'selected':''); ?>" data-productview-index="<?php echo $this->view['wpsg_mod_productview']['index']; ?>" data-order="<?php echo $value; ?>"><?php echo $label; ?></a>
+ <?php } ?>
+ </div>
+ </div>
</div>
<div class="wpsg_mod_productview-info <?php echo $this->view['wpsg_mod_productview']['col_class']['info']; ?>">
<strong><?php
echo wpsg_translate(__('Anzeige #1# - #2#', 'wpsg'),
($this->view['wpsg_mod_productview']['page'] - 1) * $this->view['wpsg_mod_productview']['per_page'] + 1,
- ((sizeof($this->view['wpsg_mod_productview']['products']) > $this->view['wpsg_mod_productview']['per_page'])?$this->view['wpsg_mod_productview']['page'] * $this->view['wpsg_mod_productview']['per_page']:sizeof($this->view['wpsg_mod_productview']['products']))
+ $this->view['wpsg_mod_productview']['pageMax']
); ?></strong>
- <?php echo wpsg_translate(__('von #1# Ergebnissen', 'wpsg'), sizeof($this->view['wpsg_mod_productview']['products'])); ?>
+ <?php echo wpsg_translate(__('von #1# Ergebnissen', 'wpsg'), $this->view['wpsg_mod_productview']['count']); ?>
</div>
<?php } ?>
diff --git a/views/mods/mod_productview/productview_filter.phtml b/views/mods/mod_productview/productview_filter.phtml
index 7456bee..125cea0 100644
--- a/views/mods/mod_productview/productview_filter.phtml
+++ b/views/mods/mod_productview/productview_filter.phtml
@@ -1,20 +1,123 @@
<div class="wpsg_mod_productview_filter" id="wpsg_mod_productview_filter">
- <?php if ($this->hasMod('wpsg_mod_produktartikel') && wpsg_isSizedArray($this->view['arCat'])) { ?>
- <div class="wpsg_mod_productview_filter_item wpsg_mod_productview_filter_cat">
- <ul>
- <?php foreach ($this->view['arCat'] as $cat_id => $cat_name) { ?>
- <li><a href="<?php echo get_term_link($cat_id); ?>" title="<?php echo wpsg_hspc($cat_name); ?>"><?php echo wpsg_hspc($cat_name); ?></a></li>
+
+ <?php foreach ($this->view['showFilter'] as $filter_data) { ?>
+
+ <?php if ($filter_data['type'] === 'catfilter') { /* Kategoriefilter */ ?>
+
+ <div class="wpsg_mod_productview_filter_item wpsg_mod_productview_filter_cat">
+ <h2><?php echo __('Produktkategorie', 'wpsg'); ?></h2>
+ <?php
+
+ function wpsg_renderCat(&$shop, $ar, $level = 1)
+ {
+
+ if (wpsg_isSizedArray($ar))
+ {
+
+ echo '<ul class="level'.$level.'">';
+
+ foreach ($ar as $k => $cat)
+ {
+
+ echo '<li>';
+ echo '<a href="'.get_term_link($cat->term_id).'" title="'.wpsg_hspc($cat->cat_name).'">'.wpsg_hspc($cat->cat_name).'</a>';
+
+ $arSubCat = $shop->callMod('wpsg_mod_produktartikel', 'getSubCategory', array($cat->term_id));
+ wpsg_renderCat($shop, $arSubCat, $level + 1);
+
+ echo '</li>';
+
+ }
+
+ echo '</ul>';
+
+ }
+
+ }
+
+ wpsg_renderCat($this, $filter_data['cat']);
+
+ ?>
+ </div>
+
+ <?php } else if ($filter_data['type'] === 'pricefilter') { ?>
+
+ <div class="wpsg_mod_productview_filter_item wpsg_mod_productview_filter_price">
+ <h2><?php echo __('Sortierung nach Preis', 'wpsg'); ?></h2>
+ <div id="wpsg_mod_productview_filter_price-range"><span class="ui-slider-bg"></span></div>
+ <div id="wpsg_mod_productview_filter_price_info">
+ <span class="min"><?php echo wpsg_ff($filter_data['min']); ?></span> <?php echo $this->get_option('wpsg_currency'); ?> - <span class="max"><?php echo wpsg_ff($filter_data['max']); ?></span> <?php echo $this->get_option('wpsg_currency'); ?>
+ <input type="hidden" name="price_min" value="<?php echo $filter_data['min']; ?>" />
+ <input type="hidden" name="price_max" value="<?php echo $filter_data['max']; ?>" />
+ </div>
+ </div>
+
+ <?php } else if ($filter_data['type'] === 'productvariants') { $variant = $filter_data['variant']; ?>
+
+ <?php if ($filter_data['displayMode'] === wpsg_mod_productview::DISPLAYMODE_FILTER_CHECKBOX) { ?>
+ <div class="wpsg_mod_productview_filter_item wpsg_mod_productview_filter_variant_checkbox wpsg_mod_productview_filter_variant wpsg_mod_productview_filter_variant_<?php echo $variant['type']; ?>">
+ <h2><?php echo $variant['name']; ?></h2>
+ <input class="val" type=hidden name="variants[<?php echo $variant['id']; ?>]" value="" />
+
+ <div class="variation_wrap">
+ <?php foreach ($filter_data['variation'] as $variation) { ?>
+ <a class="switch" href="#" data-value="<?php echo $variation['id']; ?>">
+
+ <span class="fa fa-square-o"></span>
+ <span class="fa fa-check-square-o"></span>
+
+ <?php if (wpsg_isSizedString($variation['shortname'])) { ?>
+ <?php echo wpsg_hspc($variation['shortname']); ?>
+ <?php } else { ?>
+ <?php echo wpsg_hspc($variation['name']); ?>
+ <?php } ?>
+
+ </a>
+ <?php } ?>
+ </div>
+ </div>
+ <?php } else if ($filter_data['displayMode'] === wpsg_mod_productview::DISPLAYMODE_FILTER_SMALL) { ?>
+ <div class="wpsg_mod_productview_filter_item wpsg_mod_productview_filter_variant_small wpsg_mod_productview_filter_variant wpsg_mod_productview_filter_variant_<?php echo $variant['type']; ?>">
+ <h2><?php echo $variant['name']; ?></h2>
+ <input class="val" type=hidden name="variants[<?php echo $variant['id']; ?>]" value="" />
+ <div class="variation_wrap">
+ <?php foreach ($filter_data['variation'] as $variation) { ?>
+ <a class="switch" href="#" data-value="<?php echo $variation['id']; ?>">
+
+ <?php if (wpsg_isSizedString($variation['shortname'])) { ?>
+
+ <?php if (preg_match('/^\#[0-9a-fA-F]+$/', $variation['shortname'])) { ?>
+ <span class="color" style="background-color:<?php echo $variation['shortname']; ?>;"><span class="fa-check-square-o fa"></span></span>
+ <?php } else { ?>
+ <?php echo wpsg_hspc($variation['shortname']); ?>
+ <?php } ?>
+
+ <?php } else { echo wpsg_hspc($variation['name']); } ?>
+ </a>
+ <?php } ?>
+ <div class="wpsg_clear"></div>
+ </div>
+ </div>
<?php } ?>
- </ul>
- </div>
+
+ <?php } else if ($filter_data['type'] === 'productattributs') { $attribut = $filter_data['attribute']; ?>
+ <div class="wpsg_mod_productview_filter_item wpsg_mod_productview_filter_attribut wpsg_mod_productview_filter_attribut_select">
+ <h2><?php echo wpsg_hspc($attribut['name']); ?></h2>
+ <input class="val" type=hidden name="attributs[<?php echo $attribut['id']; ?>]" value="" />
+ <div class="attribut_wrap">
+ <?php foreach ($attribut['auswahl'] as $index => $auswahl) { ?>
+ <a class="switch" href="#" data-value="<?php echo wpsg_hspc($index); ?>">
+
+ <span class="fa fa-square-o"></span>
+ <span class="fa fa-check-square-o"></span>
+ <?php echo wpsg_hspc($auswahl); ?>
+
+ </a>
+ <?php } ?>
+ </div>
+ </div>
+ <?php } ?>
+
<?php } ?>
- <div class="wpsg_mod_productview_filter_item wpsg_mod_productview_filter_price">
- <h2><?php echo __('Sortierung nach Preis', 'wpsg'); ?></h2>
- <div id="wpsg_mod_productview_filter_price-range"><span class="ui-slider-bg"></span></div>
- </div>
- <div id="wpsg_mod_productview_filter_price_info">
- <?php echo __('Preis:', 'wpsg'); ?><span class="min"><?php echo wpsg_ff($this->get_option('wpsg_mod_productview_filter_min')); ?></span> <?php echo $this->get_option('wpsg_currency'); ?> - <span class="max"><?php echo wpsg_ff($this->get_option('wpsg_mod_productview_filter_max')); ?></span> <?php echo $this->get_option('wpsg_currency'); ?>
- <input type="hidden" name="price_min" value="<?php echo $this->get_option('wpsg_mod_productview_filter_min'); ?>" />
- <input type="hidden" name="price_max" value="<?php echo $this->get_option('wpsg_mod_productview_filter_max'); ?>" />
- </div>
+
</div> \ No newline at end of file
diff --git a/views/mods/mod_productview/settings_edit.phtml b/views/mods/mod_productview/settings_edit.phtml
index bfb101d..69e9a00 100644
--- a/views/mods/mod_productview/settings_edit.phtml
+++ b/views/mods/mod_productview/settings_edit.phtml
@@ -5,5 +5,4 @@
*/
?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_productview_filter_min', __('Minimaler Preis für Preisfilter', 'wpsg'), $this->get_option('wpsg_mod_productview_filter_min')); ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_productview_filter_max', __('Maximaler Preis für Preisfilter', 'wpsg'), $this->get_option('wpsg_mod_productview_filter_max')); ?> \ No newline at end of file
+ \ No newline at end of file