From 54f69b92e73420aafd9419b71e8a9aacbc35e113 Mon Sep 17 00:00:00 2001 From: Yarik Date: Tue, 6 Jun 2017 14:02:11 +0300 Subject: [PATCH] Price filter fix --- frontend/views/category/view.php | 8 +++----- frontend/web/js/script.js | 11 ++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/views/category/view.php b/frontend/views/category/view.php index 36f29ee..46efa2c 100755 --- a/frontend/views/category/view.php +++ b/frontend/views/category/view.php @@ -164,11 +164,6 @@ _________________________________________________________ --> - -
-

-
- +
+

+
diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index fe37cfb..e91ea18 100755 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -347,17 +347,22 @@ $(function() { .val(); console.log(max, min); var href = window.location.href; + var question = href.indexOf('?'); + if (question !== -1) { + var queryString = href.substr(question); + href = href.substr(0, question); + } var count = 0; var pos = -1; while ((pos = href.indexOf('/', pos + 1)) !== -1) { count++; } if (count === 5) { - window.location.href = href + '/price-' + min + '-' + max; + window.location.href = href + '/price-' + min + '-' + max + queryString; } else { - var result = window.location.href.match(/\/[^\/]*price-(\d+)-(\d+)$/); + var result = href.match(/\/[^\/]*price-(\d+)-(\d+)$/); if (result) { - window.location.href = window.location.href.replace(/(\/[^\/]*)price-\d+-\d+$/, '$1price-' + min + '-' + max); + window.location.href = href.replace(/(\/[^\/]*)price-\d+-\d+$/, '$1price-' + min + '-' + max) + queryString; } } }); -- libgit2 0.21.4