From 635f37617929a30c5f064a92b334a220d32ad67f Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 15 Nov 2016 11:29:20 +0200 Subject: [PATCH] Ntr --- .htaccess | 4 ++-- frontend/controllers/CatalogController.php | 9 +-------- frontend/models/ProductFrontendSearch.php | 8 +++++++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.htaccess b/.htaccess index bb5adae..bfafcfa 100755 --- a/.htaccess +++ b/.htaccess @@ -12,7 +12,7 @@ AddDefaultCharset utf-8 # deal with admin first #liniya svitla only - Redirect 301 /lyustry-2.htm /catalog/lyustry-i-potolochnoe-osveshchenie + Redirect 301 /lyustry-2.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:podrazdel-lustri=lyustra Redirect 301 /sovremennye-3448.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:style-lustri=sovremennyy-6 Redirect 301 /klassicheskie-3407.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:style-lustri=klassicheskiy-4 Redirect 301 /podvesnye-3439.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:podrazdel-lustri=podves @@ -37,7 +37,7 @@ AddDefaultCharset utf-8 Redirect 301 /lampochki-29/fcatlist-36.htm /catalog/lampochki/filters:podrazdel-lampo4ki=lyuminiscentnye Redirect 301 /lampochki-29/fcatlist-30.htm /catalog/lampochki/filters:podrazdel-lampo4ki=nakalivaniya Redirect 301 /lampochki-29/fcatlist-43.htm /catalog/lampochki/filters:podrazdel-lampo4ki=svetodiodnye-led - Redirect 301 /bra-5.htm /catalog/bra-i-nastennoe-osveshchenie + Redirect 301 /bra-5.htm /catalog/bra-i-nastennoe-osveshchenie/filters:podrazdel-bra=bra Redirect 301 /bra-5/fbrandlist-7 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=elstead Redirect 301 /bra-5/fbrandlist-2 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=eseo Redirect 301 /bra-5/fbrandlist-3 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=lirio diff --git a/frontend/controllers/CatalogController.php b/frontend/controllers/CatalogController.php index 935fc44..5a115a5 100755 --- a/frontend/controllers/CatalogController.php +++ b/frontend/controllers/CatalogController.php @@ -150,14 +150,7 @@ class CatalogController extends \yii\web\Controller - $cacheKey = ['ActiveProperties','id' => $category]; - - if(!$priceLimits = Yii::$app->cache->get($cacheKey)){ - - $priceLimits = $productModel->priceLimits($category); - - Yii::$app->cache->set($cacheKey,$priceLimits,3600*24); - } + $priceLimits = $productModel->priceLimits($category, $params); return $this->render('products', [ diff --git a/frontend/models/ProductFrontendSearch.php b/frontend/models/ProductFrontendSearch.php index 82b53af..533382b 100755 --- a/frontend/models/ProductFrontendSearch.php +++ b/frontend/models/ProductFrontendSearch.php @@ -119,15 +119,21 @@ class ProductFrontendSearch extends Product { * @return array */ - public function priceLimits($category = null) { + public function priceLimits($category = null, $params = []) { if (!empty($category)) { /** @var ActiveQuery $query */ +// $query = $category->getRelations('product_categories'); $query = $category->getProducts(); } else { $query = Product::find(); } $query->joinWith('variant'); + // Price filter fix + unset($params['prices']); + + ProductHelper::_setQueryParams($query, $params); + return [ 'min' => $query->min(ProductVariant::tableName() .'.price'), 'max' => $query->max(ProductVariant::tableName() .'.price'), -- libgit2 0.21.4