// 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
This commit is contained in:
mDeflotte
2012-07-09 12:41:38 +00:00
parent 9bd099bb3a
commit 389fddd46e
3 changed files with 24 additions and 12 deletions
+14 -8
View File
@@ -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];
}
+8 -2
View File
@@ -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 '
<script type="text/javascript">
//<![CDATA[
+2 -2
View File
@@ -44,7 +44,7 @@
//<![CDATA[
$(document).ready(function()
{
$('#selectPrductSort').change(function()
$('.selectProductSort').change(function()
{
var requestSortProducts = '{$request}';
var splitData = $(this).val().split(':');
@@ -57,7 +57,7 @@ $(document).ready(function()
<form id="productsSortForm" action="{$request|escape:'htmlall':'UTF-8'}">
<p class="select">
<label for="selectPrductSort">{l s='Sort by'}</label>
<select id="selectPrductSort">
<select id="selectPrductSort" class="selectProductSort">
<option value="{$orderbydefault|escape:'htmlall':'UTF-8'}:{$orderwaydefault|escape:'htmlall':'UTF-8'}" {if $orderby eq $orderbydefault}selected="selected"{/if}>{l s='--'}</option>
{if !$PS_CATALOG_MODE}
<option value="price:asc" {if $orderby eq 'price' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Price: lowest first'}</option>