Commit 635f37617929a30c5f064a92b334a220d32ad67f
1 parent
a452c3af
Ntr
Showing
3 changed files
with
10 additions
and
11 deletions
Show diff stats
.htaccess
| @@ -12,7 +12,7 @@ AddDefaultCharset utf-8 | @@ -12,7 +12,7 @@ AddDefaultCharset utf-8 | ||
| 12 | # deal with admin first | 12 | # deal with admin first |
| 13 | #liniya svitla only | 13 | #liniya svitla only |
| 14 | 14 | ||
| 15 | - Redirect 301 /lyustry-2.htm /catalog/lyustry-i-potolochnoe-osveshchenie | 15 | + Redirect 301 /lyustry-2.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:podrazdel-lustri=lyustra |
| 16 | Redirect 301 /sovremennye-3448.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:style-lustri=sovremennyy-6 | 16 | Redirect 301 /sovremennye-3448.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:style-lustri=sovremennyy-6 |
| 17 | Redirect 301 /klassicheskie-3407.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:style-lustri=klassicheskiy-4 | 17 | Redirect 301 /klassicheskie-3407.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:style-lustri=klassicheskiy-4 |
| 18 | Redirect 301 /podvesnye-3439.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:podrazdel-lustri=podves | 18 | Redirect 301 /podvesnye-3439.htm /catalog/lyustry-i-potolochnoe-osveshchenie/filters:podrazdel-lustri=podves |
| @@ -37,7 +37,7 @@ AddDefaultCharset utf-8 | @@ -37,7 +37,7 @@ AddDefaultCharset utf-8 | ||
| 37 | Redirect 301 /lampochki-29/fcatlist-36.htm /catalog/lampochki/filters:podrazdel-lampo4ki=lyuminiscentnye | 37 | Redirect 301 /lampochki-29/fcatlist-36.htm /catalog/lampochki/filters:podrazdel-lampo4ki=lyuminiscentnye |
| 38 | Redirect 301 /lampochki-29/fcatlist-30.htm /catalog/lampochki/filters:podrazdel-lampo4ki=nakalivaniya | 38 | Redirect 301 /lampochki-29/fcatlist-30.htm /catalog/lampochki/filters:podrazdel-lampo4ki=nakalivaniya |
| 39 | Redirect 301 /lampochki-29/fcatlist-43.htm /catalog/lampochki/filters:podrazdel-lampo4ki=svetodiodnye-led | 39 | Redirect 301 /lampochki-29/fcatlist-43.htm /catalog/lampochki/filters:podrazdel-lampo4ki=svetodiodnye-led |
| 40 | - Redirect 301 /bra-5.htm /catalog/bra-i-nastennoe-osveshchenie | 40 | + Redirect 301 /bra-5.htm /catalog/bra-i-nastennoe-osveshchenie/filters:podrazdel-bra=bra |
| 41 | Redirect 301 /bra-5/fbrandlist-7 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=elstead | 41 | Redirect 301 /bra-5/fbrandlist-7 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=elstead |
| 42 | Redirect 301 /bra-5/fbrandlist-2 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=eseo | 42 | Redirect 301 /bra-5/fbrandlist-2 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=eseo |
| 43 | Redirect 301 /bra-5/fbrandlist-3 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=lirio | 43 | Redirect 301 /bra-5/fbrandlist-3 /catalog/bra-i-nastennoe-osveshchenie/filters:brands=lirio |
frontend/controllers/CatalogController.php
| @@ -150,14 +150,7 @@ class CatalogController extends \yii\web\Controller | @@ -150,14 +150,7 @@ class CatalogController extends \yii\web\Controller | ||
| 150 | 150 | ||
| 151 | 151 | ||
| 152 | 152 | ||
| 153 | - $cacheKey = ['ActiveProperties','id' => $category]; | ||
| 154 | - | ||
| 155 | - if(!$priceLimits = Yii::$app->cache->get($cacheKey)){ | ||
| 156 | - | ||
| 157 | - $priceLimits = $productModel->priceLimits($category); | ||
| 158 | - | ||
| 159 | - Yii::$app->cache->set($cacheKey,$priceLimits,3600*24); | ||
| 160 | - } | 153 | + $priceLimits = $productModel->priceLimits($category, $params); |
| 161 | 154 | ||
| 162 | 155 | ||
| 163 | return $this->render('products', [ | 156 | return $this->render('products', [ |
frontend/models/ProductFrontendSearch.php
| @@ -119,15 +119,21 @@ class ProductFrontendSearch extends Product { | @@ -119,15 +119,21 @@ class ProductFrontendSearch extends Product { | ||
| 119 | * @return array | 119 | * @return array |
| 120 | */ | 120 | */ |
| 121 | 121 | ||
| 122 | - public function priceLimits($category = null) { | 122 | + public function priceLimits($category = null, $params = []) { |
| 123 | if (!empty($category)) { | 123 | if (!empty($category)) { |
| 124 | /** @var ActiveQuery $query */ | 124 | /** @var ActiveQuery $query */ |
| 125 | +// $query = $category->getRelations('product_categories'); | ||
| 125 | $query = $category->getProducts(); | 126 | $query = $category->getProducts(); |
| 126 | } else { | 127 | } else { |
| 127 | $query = Product::find(); | 128 | $query = Product::find(); |
| 128 | } | 129 | } |
| 129 | $query->joinWith('variant'); | 130 | $query->joinWith('variant'); |
| 130 | 131 | ||
| 132 | + // Price filter fix | ||
| 133 | + unset($params['prices']); | ||
| 134 | + | ||
| 135 | + ProductHelper::_setQueryParams($query, $params); | ||
| 136 | + | ||
| 131 | return [ | 137 | return [ |
| 132 | 'min' => $query->min(ProductVariant::tableName() .'.price'), | 138 | 'min' => $query->min(ProductVariant::tableName() .'.price'), |
| 133 | 'max' => $query->max(ProductVariant::tableName() .'.price'), | 139 | 'max' => $query->max(ProductVariant::tableName() .'.price'), |