From c61fb6df5372d307e0cc71acdf62dbd00dd8818d Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Wed, 1 Feb 2012 10:01:44 +0000 Subject: [PATCH] // Blocklayered : Fix bug with ordering and some old theme git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12885 b9a71923-0436-4b27-9f14-aed3839534dd --- modules/blocklayered/blocklayered.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/blocklayered/blocklayered.js b/modules/blocklayered/blocklayered.js index b78d268f6..38ccc0329 100644 --- a/modules/blocklayered/blocklayered.js +++ b/modules/blocklayered/blocklayered.js @@ -119,7 +119,9 @@ $(document).ready(function() $('#selectPrductSort').unbind('change'); // To be sure there is no other events attached to the selectPrductSort, change the ID + $('#selectPrductSort').attr('onchange', ''); $('#selectPrductSort').attr('id', 'selectPrductSort2'); + $('label[for=selectPrductSort]').attr('for', 'selectPrductSort2'); $('#selectPrductSort2').live('change', function(event) { reloadContent(); }); @@ -306,7 +308,19 @@ function reloadContent(params_plus) if ($('#selectPrductSort2').length) { - var splitData = $('#selectPrductSort2').val().split(':'); + if ($('#selectPrductSort2').val().search(/orderby=/) > 0) + { + // Old ordering working + var splitData = [ + $('#selectPrductSort2').val().match(/orderby=(\w*)/)[1], + $('#selectPrductSort2').val().match(/orderway=(\w*)/)[1] + ]; + } + else + { + // New working for default theme 1.4 and theme 1.5 + var splitData = $('#selectPrductSort2').val().split(':'); + } data += '&orderby='+splitData[0]+'&orderway='+splitData[1]; }