From f5ecb5510e71825878ab5e06ddf7b332d6dbe4b7 Mon Sep 17 00:00:00 2001 From: saparatayev Date: Wed, 4 Aug 2021 19:28:37 +0500 Subject: [PATCH] fix search, added filter --- plugins/tps/birzha/components/Offers.php | 16 +++++++++- .../tps/birzha/components/offers/default.htm | 4 +-- shablon/category.html | 2 ++ themes/birzha/pages/category.htm | 30 ++++++++++++++++++- themes/birzha/pages/index.htm | 9 +----- 5 files changed, 49 insertions(+), 12 deletions(-) diff --git a/plugins/tps/birzha/components/Offers.php b/plugins/tps/birzha/components/Offers.php index 9d57ebddd..4f6deb80d 100644 --- a/plugins/tps/birzha/components/Offers.php +++ b/plugins/tps/birzha/components/Offers.php @@ -9,6 +9,11 @@ use DB; class Offers extends ComponentBase { + /* + * sort order parametr in a url string + */ + public $sortParam = ''; + public function componentDetails() { return [ @@ -66,7 +71,16 @@ class Offers extends ComponentBase } protected function loadOffers() { - $sortOrder = $this->property('sortOrder'); + $sortOrderParam = strtolower(\Input::get('sort_order')); + + // protect from sql injection + if($sortOrderParam != 'asc' && $sortOrderParam != 'desc') { + $sortOrder = $this->property('sortOrder'); + } else { + $sortOrder = $sortOrderParam; + $this->sortParam = $sortOrderParam; + } + $cSlug = $this->property('categorySlug'); $perPage = $this->property('perPage'); $productSlug = $this->property('productSlug'); diff --git a/plugins/tps/birzha/components/offers/default.htm b/plugins/tps/birzha/components/offers/default.htm index 73eaf7b4c..869d715ba 100644 --- a/plugins/tps/birzha/components/offers/default.htm +++ b/plugins/tps/birzha/components/offers/default.htm @@ -59,13 +59,13 @@ {% if offers.total > offers.perPage %}
- +
- +
diff --git a/shablon/category.html b/shablon/category.html index 3dde5af6e..fa7fc914e 100644 --- a/shablon/category.html +++ b/shablon/category.html @@ -357,6 +357,8 @@ loupe
+ +
+ +
+
+
+
+ + {% if input('page') %} + + {% endif %} +
+
Лот №: @@ -84,4 +104,12 @@ sortOrder = "desc"
- \ No newline at end of file + + +{% put scripts %} + +{% endput %} \ No newline at end of file diff --git a/themes/birzha/pages/index.htm b/themes/birzha/pages/index.htm index 0c27c4f7a..4e4dfe5fd 100644 --- a/themes/birzha/pages/index.htm +++ b/themes/birzha/pages/index.htm @@ -23,14 +23,7 @@ localeUrl[ru] = "/glavnaya-stranica" {% endput %} -
-
-
- - -
-
-
+