From 549190925773fe7f15dc44747fc72ea4a67e5610 Mon Sep 17 00:00:00 2001 From: Catalin Ciobanu Date: Thu, 27 Oct 2016 20:19:21 +0300 Subject: [PATCH] Fixed price slider --- .../default/js/catalin_seo/handler-ee-rwd.js | 29 ++++++++++------- .../base/default/js/catalin_seo/handler.js | 31 +++++++++++-------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/skin/frontend/base/default/js/catalin_seo/handler-ee-rwd.js b/skin/frontend/base/default/js/catalin_seo/handler-ee-rwd.js index 27f329d..ad1c57d 100644 --- a/skin/frontend/base/default/js/catalin_seo/handler-ee-rwd.js +++ b/skin/frontend/base/default/js/catalin_seo/handler-ee-rwd.js @@ -14,7 +14,7 @@ var CatalinSeoHandler = { if (val) { var url = self.priceSlider.urlTemplate.replace('__PRICE_VALUE__', val); if (self.isAjaxEnabled) { - self.handleEvent(url); + self.sendAjaxRequest(url); } else { window.location.href = url; } @@ -23,11 +23,11 @@ var CatalinSeoHandler = { handleEvent: function (el, event) { var url, fullUrl; var self = this; - if (typeof el === 'string') { - url = el; + if (el.tagName.toLowerCase() === 'input') { + url = $(el).getAttribute('value'); } else if (el.tagName.toLowerCase() === 'a') { url = $(el).readAttribute('href'); - } else if (el.tagName.toLowerCase() === 'select' || el.tagName.toLowerCase() === 'input') { + } else if (el.tagName.toLowerCase() === 'select') { url = $(el).getValue(); } @@ -36,6 +36,15 @@ var CatalinSeoHandler = { return; } + self.sendAjaxRequest(url); + + if (event) { + event.preventDefault(); + } + }, + sendAjaxRequest: function(url) { + var fullUrl; + var self = this; fullUrl = self.prepareAjaxUrl(url); $('loading').show(); @@ -43,10 +52,6 @@ var CatalinSeoHandler = { self.pushState(null, url, false); - self.showMoreListener(); - - self.searchBoxListener(); - new Ajax.Request(fullUrl, { method: 'get', onSuccess: function (transport) { @@ -61,6 +66,8 @@ var CatalinSeoHandler = { self.toggleContent(); self.alignProductGridActions(); self.blockCollapsing(); + self.showMoreListener(); + self.searchBoxListener(); if (ConfigurableSwatchesList) { setTimeout(function(){ @@ -74,10 +81,6 @@ var CatalinSeoHandler = { }, onComplete: CatalinSeoHandler.sendUpdateEvent }); - - if (event) { - event.preventDefault(); - } }, sendUpdateEvent: function() { $j(document).trigger('catalin:updatePage'); @@ -209,6 +212,8 @@ var CatalinSeoHandler = { self.toggleContent(); self.alignProductGridActions(); self.blockCollapsing(); + self.showMoreListener(); + self.searchBoxListener(); if (ConfigurableSwatchesList) { setTimeout(function(){ diff --git a/skin/frontend/base/default/js/catalin_seo/handler.js b/skin/frontend/base/default/js/catalin_seo/handler.js index 5d1dcdd..3cf934a 100644 --- a/skin/frontend/base/default/js/catalin_seo/handler.js +++ b/skin/frontend/base/default/js/catalin_seo/handler.js @@ -13,20 +13,20 @@ var CatalinSeoHandler = { if (val) { var url = self.priceSlider.urlTemplate.replace('__PRICE_VALUE__', val); if (self.isAjaxEnabled) { - self.handleEvent(url); + self.sendAjaxRequest(url); } else { window.location.href = url; } } }, handleEvent: function (el, event) { - var url, fullUrl; + var url; var self = this; - if (typeof el === 'string') { - url = el; + if (el.tagName.toLowerCase() === 'input') { + url = $(el).getAttribute('value'); } else if (el.tagName.toLowerCase() === 'a') { url = $(el).readAttribute('href'); - } else if (el.tagName.toLowerCase() === 'select' || el.tagName.toLowerCase() === 'input') { + } else if (el.tagName.toLowerCase() === 'select') { url = $(el).getValue(); } @@ -35,6 +35,15 @@ var CatalinSeoHandler = { return; } + self.sendAjaxRequest(url); + + if (event) { + event.preventDefault(); + } + }, + sendAjaxRequest: function(url) { + var fullUrl; + var self = this; // Add this to query string for full page caching systems if (url.indexOf('?') != -1) { fullUrl = url + '&isLayerAjax=1'; @@ -47,10 +56,6 @@ var CatalinSeoHandler = { self.pushState(null, url, false); - self.showMoreListener(); - - self.searchBoxListener(); - new Ajax.Request(fullUrl, { method: 'get', onSuccess: function (transport) { @@ -65,6 +70,8 @@ var CatalinSeoHandler = { self.toggleContent(); self.alignProductGridActions(); self.blockCollapsing(); + self.showMoreListener(); + self.searchBoxListener(); if (ConfigurableSwatchesList) { setTimeout(function(){ @@ -78,10 +85,6 @@ var CatalinSeoHandler = { }, onComplete: CatalinSeoHandler.sendUpdateEvent }); - - if (event) { - event.preventDefault(); - } }, sendUpdateEvent: function() { $j(document).trigger('catalin:updatePage'); @@ -172,6 +175,8 @@ var CatalinSeoHandler = { self.toggleContent(); self.alignProductGridActions(); self.blockCollapsing(); + self.showMoreListener(); + self.searchBoxListener(); if (ConfigurableSwatchesList) { setTimeout(function(){