From 389fddd46ebe517c5ef8a2d79c5d04a906d7122d Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Mon, 9 Jul 2012 12:41:38 +0000 Subject: [PATCH] // Blocklayered: Fix bug with product order select on 1.5 // Theme 1.5: Fix bug on change product order with the select on the bottom of the page --- modules/blocklayered/blocklayered.js | 22 ++++++++++++++-------- modules/blocklayered/blocklayered.php | 10 ++++++++-- themes/default/product-sort.tpl | 4 ++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/modules/blocklayered/blocklayered.js b/modules/blocklayered/blocklayered.js index eac834ec2..da3229ba8 100644 --- a/modules/blocklayered/blocklayered.js +++ b/modules/blocklayered/blocklayered.js @@ -130,13 +130,19 @@ $(document).ready(function() // Unbind event change on #selectPrductSort $('#selectPrductSort').unbind('change'); $('#selectPrductSort').attr('onchange', ''); - $('#selectPrductSort').addClass('selectPrductSort'); + $('#selectPrductSort').addClass('selectProductSort'); $('#selectPrductSort').attr('id', 'selectPrductSort'+id); $('label[for=selectPrductSort]').attr('for', 'selectPrductSort'+id); id++; } - $('.selectPrductSort').live('change', function(event) { - $('.selectPrductSort').val($(this).val()); + + // Since 1.5, event is add to .selectProductSort and not to #selectPrductSort + setTimeout(function() { + $('.selectProductSort').unbind('change'); + }, 100); + + $('.selectProductSort').live('change', function(event) { + $('.selectProductSort').val($(this).val()); reloadContent(); }); @@ -353,20 +359,20 @@ function reloadContent(params_plus) } }); - if ($('.selectPrductSort').length && $('.selectPrductSort').val()) + if ($('.selectProductSort').length && $('.selectProductSort').val()) { - if ($('.selectPrductSort').val().search(/orderby=/) > 0) + if ($('.selectProductSort').val().search(/orderby=/) > 0) { // Old ordering working var splitData = [ - $('.selectPrductSort').val().match(/orderby=(\w*)/)[1], - $('.selectPrductSort').val().match(/orderway=(\w*)/)[1] + $('.selectProductSort').val().match(/orderby=(\w*)/)[1], + $('.selectProductSort').val().match(/orderway=(\w*)/)[1] ]; } else { // New working for default theme 1.4 and theme 1.5 - var splitData = $('.selectPrductSort').val().split(':'); + var splitData = $('.selectProductSort').val().split(':'); } data += '&orderby='+splitData[0]+'&orderway='+splitData[1]; } diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index 5f9918190..002ffde81 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -39,7 +39,7 @@ class BlockLayered extends Module { $this->name = 'blocklayered'; $this->tab = 'front_office_features'; - $this->version = '1.8.7'; + $this->version = '1.8.8'; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -1338,7 +1338,13 @@ class BlockLayered extends Module public function hookFooter($params) { - if (basename($_SERVER['PHP_SELF']) == 'category.php') + // No filters => module disable + if ($filter_block = $this->getFilterBlock($this->getSelectedFilters())) + if ($filter_block['nbr_filterBlocks'] == 0) + return false; + + if (basename($_SERVER['PHP_SELF']) == 'category.php' && version_compare(_PS_VERSION_, '1.5', '<') + || version_compare(_PS_VERSION_, '1.5', '>') && Dispatcher::getInstance()->getController() == 'category') return '