Commit b905419d39dad9b10c06216559e84207ba134310
1 parent
66285eca
big commti
Showing
20 changed files
with
266 additions
and
211 deletions
Show diff stats
.htaccess
@@ -13,7 +13,6 @@ AddDefaultCharset utf-8 | @@ -13,7 +13,6 @@ AddDefaultCharset utf-8 | ||
13 | RewriteBase / | 13 | RewriteBase / |
14 | # deal with admin first | 14 | # deal with admin first |
15 | 15 | ||
16 | - | ||
17 | Redirect 301 /Kak_vibrat_ryuksak / | 16 | Redirect 301 /Kak_vibrat_ryuksak / |
18 | Redirect 301 /products/ryukzaki /catalog/ryukzaki | 17 | Redirect 301 /products/ryukzaki /catalog/ryukzaki |
19 | Redirect 301 /products/koshel_ki /catalog/koshelki | 18 | Redirect 301 /products/koshel_ki /catalog/koshelki |
@@ -90,10 +89,8 @@ AddDefaultCharset utf-8 | @@ -90,10 +89,8 @@ AddDefaultCharset utf-8 | ||
90 | RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] | 89 | RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] |
91 | RewriteRule /$ /%1 [R,L] | 90 | RewriteRule /$ /%1 [R,L] |
92 | 91 | ||
93 | - | ||
94 | - | ||
95 | -# RewriteCond %{HTTP_HOST} ^([^www].*)$ | ||
96 | -# RewriteRule ^(.*)$ http://www.%1/$1 [R=301] | 92 | + RewriteCond %{HTTP_HOST} ^([^www].*)$ |
93 | + RewriteRule ^(.*)$ http://www.%1/$1 [R=301] | ||
97 | 94 | ||
98 | </IfModule> | 95 | </IfModule> |
99 | 96 |
backend/controllers/EventController.php
@@ -161,6 +161,7 @@ class EventController extends Controller | @@ -161,6 +161,7 @@ class EventController extends Controller | ||
161 | 161 | ||
162 | public function actionDelimg($id,$field){ | 162 | public function actionDelimg($id,$field){ |
163 | $model = $this->findModel($id); | 163 | $model = $this->findModel($id); |
164 | + $model->detachBehavior('img'); | ||
164 | $model->$field = ''; | 165 | $model->$field = ''; |
165 | $model->save(); | 166 | $model->save(); |
166 | return true; | 167 | return true; |
common/models/Event.php
@@ -47,7 +47,7 @@ class Event extends \yii\db\ActiveRecord | @@ -47,7 +47,7 @@ class Event extends \yii\db\ActiveRecord | ||
47 | public function behaviors() | 47 | public function behaviors() |
48 | { | 48 | { |
49 | return [ | 49 | return [ |
50 | - [ | 50 | + 'img'=>[ |
51 | 'class' => SaveImgBehavior::className(), | 51 | 'class' => SaveImgBehavior::className(), |
52 | 'fields' => [ | 52 | 'fields' => [ |
53 | ['name'=>'imageUpload','directory' => 'event' ], | 53 | ['name'=>'imageUpload','directory' => 'event' ], |
common/modules/product/CatalogUrlManager.php
@@ -2,10 +2,12 @@ | @@ -2,10 +2,12 @@ | ||
2 | 2 | ||
3 | namespace common\modules\product; | 3 | namespace common\modules\product; |
4 | 4 | ||
5 | - | 5 | +use common\modules\product\helpers\FilterHelper; |
6 | +use common\modules\product\models\Brand; | ||
7 | +use common\modules\product\models\BrandSearch; | ||
6 | use common\modules\product\models\CategorySearch; | 8 | use common\modules\product\models\CategorySearch; |
7 | use common\modules\product\models\ProductSearch; | 9 | use common\modules\product\models\ProductSearch; |
8 | - | 10 | +use common\modules\rubrication\models\TaxOption; |
9 | use Yii; | 11 | use Yii; |
10 | use yii\helpers\Url; | 12 | use yii\helpers\Url; |
11 | use yii\web\HttpException; | 13 | use yii\web\HttpException; |
@@ -13,6 +15,8 @@ use yii\web\UrlRuleInterface; | @@ -13,6 +15,8 @@ use yii\web\UrlRuleInterface; | ||
13 | 15 | ||
14 | class CatalogUrlManager implements UrlRuleInterface { | 16 | class CatalogUrlManager implements UrlRuleInterface { |
15 | public $route_map = []; | 17 | public $route_map = []; |
18 | + | ||
19 | + public $option_prefix = 'o:'; | ||
16 | /** | 20 | /** |
17 | * Parses the given request and returns the corresponding route and parameters. | 21 | * Parses the given request and returns the corresponding route and parameters. |
18 | * @param \yii\web\UrlManager $manager the URL manager | 22 | * @param \yii\web\UrlManager $manager the URL manager |
@@ -25,12 +29,6 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -25,12 +29,6 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
25 | $pathInfo = $request->getPathInfo(); | 29 | $pathInfo = $request->getPathInfo(); |
26 | $paths = explode('/', $pathInfo); | 30 | $paths = explode('/', $pathInfo); |
27 | 31 | ||
28 | - if(isset($paths[1])) { | ||
29 | - if(strripos($request->url,'catalog/'.$paths[1].'?') && (!strripos($request->url,'?page')) && (!strripos($request->url,'?sort'))){ | ||
30 | - throw new HttpException(404 ,'Page not found'); | ||
31 | - } | ||
32 | - | ||
33 | - } | ||
34 | 32 | ||
35 | 33 | ||
36 | if (!array_key_exists($paths[0], $this->route_map)) { | 34 | if (!array_key_exists($paths[0], $this->route_map)) { |
@@ -56,6 +54,24 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -56,6 +54,24 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
56 | $this->parseFilter($paths[2], $params); | 54 | $this->parseFilter($paths[2], $params); |
57 | 55 | ||
58 | } | 56 | } |
57 | + else if(strpos($paths[2], 'filter:') === 0){ | ||
58 | + $this->parseOldFilter($paths[2], $params); | ||
59 | + //['catalog/category', 'category' => $category, 'filters' =>$params['filter']] | ||
60 | + | ||
61 | + $optionsTemplate = FilterHelper::optionsTemplate(); | ||
62 | + array_unshift($optionsTemplate, "special", "brands"); | ||
63 | + $filterView = []; | ||
64 | + foreach($optionsTemplate as $optionKey){ | ||
65 | + if(isset($params['filter'][$optionKey])){ | ||
66 | + $filterView[$optionKey] = $params['filter'][$optionKey]; | ||
67 | + } | ||
68 | + | ||
69 | + | ||
70 | + } | ||
71 | + | ||
72 | + | ||
73 | + Yii::$app->response->redirect(['catalog/category', 'category' => $category, 'filters' =>$filterView],301); | ||
74 | + } | ||
59 | else { | 75 | else { |
60 | throw new HttpException(404 ,'Page not found'); | 76 | throw new HttpException(404 ,'Page not found'); |
61 | } | 77 | } |
@@ -95,7 +111,6 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -95,7 +111,6 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
95 | if (!empty($params['category'])) { | 111 | if (!empty($params['category'])) { |
96 | $category_alias = is_object($params['category']) ? $params['category']->alias : strtolower($params['category']); | 112 | $category_alias = is_object($params['category']) ? $params['category']->alias : strtolower($params['category']); |
97 | $url = 'catalog/'. $category_alias .'/'; | 113 | $url = 'catalog/'. $category_alias .'/'; |
98 | - unset($params['category']); | ||
99 | } else { | 114 | } else { |
100 | $url = 'catalog/'; | 115 | $url = 'catalog/'; |
101 | } | 116 | } |
@@ -118,7 +133,6 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -118,7 +133,6 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
118 | case 'catalog/product': | 133 | case 'catalog/product': |
119 | if (!empty($params['product'])) { | 134 | if (!empty($params['product'])) { |
120 | $product_alias = is_object($params['product']) ? $params['product']->alias : strtolower($params['product']); | 135 | $product_alias = is_object($params['product']) ? $params['product']->alias : strtolower($params['product']); |
121 | - unset($params['product']); | ||
122 | } | 136 | } |
123 | $url = 'product/'. $product_alias; | 137 | $url = 'product/'. $product_alias; |
124 | 138 | ||
@@ -131,6 +145,23 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -131,6 +145,23 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
131 | return $url; | 145 | return $url; |
132 | break; | 146 | break; |
133 | 147 | ||
148 | +// case 'catalog/brands': | ||
149 | +// if (empty($params['brand'])) { | ||
150 | +// return 'brands'; | ||
151 | +// } else { | ||
152 | +// | ||
153 | +// $brand_alias = is_object($params['brand']) ? $params['brand']->alias : strtolower($params['brand']); | ||
154 | +// } | ||
155 | +// $url = 'brands/'. $brand_alias .'/'; | ||
156 | +// | ||
157 | +// $this->setFilterUrl($params, $url); | ||
158 | +// | ||
159 | +// if (!empty($params) && ($query = http_build_query($params)) !== '') { | ||
160 | +// $url .= '?' . $query; | ||
161 | +// } | ||
162 | +// | ||
163 | +// return $url; | ||
164 | +// break; | ||
134 | } | 165 | } |
135 | } | 166 | } |
136 | 167 | ||
@@ -173,18 +204,51 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -173,18 +204,51 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
173 | if (empty($filter_option)) { | 204 | if (empty($filter_option)) { |
174 | continue; | 205 | continue; |
175 | } | 206 | } |
207 | + $filter_exp = explode('=', $filter_option); | ||
208 | + | ||
209 | + if(isset($filter_exp[1])){ | ||
210 | + list($filter_key, $filter_option) = explode('=', $filter_option); | ||
211 | + if($filter_key == 'prices') { // price-interval section | ||
212 | + $prices = explode(':', $filter_option); | ||
213 | + $params['filters'][$filter_key] = [ | ||
214 | + 'min' => floatval($prices[0]), | ||
215 | + 'max' => floatval($prices[1]), | ||
216 | + ]; | ||
217 | + } | ||
218 | + else { // brands and other sections | ||
219 | + $params['filters'][$filter_key] = explode(',', $filter_option); | ||
220 | + } | ||
221 | + } else { | ||
222 | + throw new HttpException(404 ,'Page not found'); | ||
223 | + } | ||
224 | + | ||
225 | + } | ||
226 | + } | ||
227 | + | ||
228 | + | ||
229 | + | ||
230 | + private function parseOldFilter($paths, &$params) { | ||
231 | + $params['filter'] = []; | ||
232 | + $filter_str = substr($paths, 7); | ||
233 | + $filter_options = explode(';', $filter_str); | ||
234 | + foreach ($filter_options as $filter_option) { | ||
235 | + if (empty($filter_option)) { | ||
236 | + continue; | ||
237 | + } | ||
176 | list($filter_key, $filter_option) = explode('=', $filter_option); | 238 | list($filter_key, $filter_option) = explode('=', $filter_option); |
177 | if($filter_key == 'prices') { // price-interval section | 239 | if($filter_key == 'prices') { // price-interval section |
178 | $prices = explode(':', $filter_option); | 240 | $prices = explode(':', $filter_option); |
179 | - $params['filters'][$filter_key] = [ | 241 | + $params['filter'][$filter_key] = [ |
180 | 'min' => floatval($prices[0]), | 242 | 'min' => floatval($prices[0]), |
181 | 'max' => floatval($prices[1]), | 243 | 'max' => floatval($prices[1]), |
182 | ]; | 244 | ]; |
183 | } | 245 | } |
246 | + elseif (strpos($filter_key, $this->option_prefix) === 0) { // options section | ||
247 | + $params['filter'][substr($filter_key, 2)] = explode(',', $filter_option); | ||
248 | + } | ||
184 | else { // brands and other sections | 249 | else { // brands and other sections |
185 | - $params['filters'][$filter_key] = explode(',', $filter_option); | 250 | + $params['filter'][$filter_key] = explode(',', $filter_option); |
186 | } | 251 | } |
187 | } | 252 | } |
188 | } | 253 | } |
189 | - | ||
190 | } | 254 | } |
191 | \ No newline at end of file | 255 | \ No newline at end of file |
common/modules/product/models/Category.php
@@ -208,7 +208,6 @@ class Category extends \yii\db\ActiveRecord | @@ -208,7 +208,6 @@ class Category extends \yii\db\ActiveRecord | ||
208 | ->innerJoin('product_variant', 'product_variant.product_variant_id = product_variant_option.product_variant_id') | 208 | ->innerJoin('product_variant', 'product_variant.product_variant_id = product_variant_option.product_variant_id') |
209 | ->innerJoin('product', 'product.product_id = product_variant.product_id') | 209 | ->innerJoin('product', 'product.product_id = product_variant.product_id') |
210 | ->innerJoin('product_category', 'product_category.product_id = product.product_id') | 210 | ->innerJoin('product_category', 'product_category.product_id = product.product_id') |
211 | - ->innerJoin('tax_value_string', 'tax_value_string.tax_option_id = tax_option.tax_option_id') | ||
212 | ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id') | 211 | ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id') |
213 | ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id]) | 212 | ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id]) |
214 | ->andWhere(['!=', 'product_variant.stock', 0]); | 213 | ->andWhere(['!=', 'product_variant.stock', 0]); |
@@ -224,7 +223,6 @@ class Category extends \yii\db\ActiveRecord | @@ -224,7 +223,6 @@ class Category extends \yii\db\ActiveRecord | ||
224 | ->innerJoin('product', 'product.product_id = product_option.product_id') | 223 | ->innerJoin('product', 'product.product_id = product_option.product_id') |
225 | ->innerJoin('product_category', 'product_category.product_id = product.product_id') | 224 | ->innerJoin('product_category', 'product_category.product_id = product.product_id') |
226 | ->innerJoin('product_variant', 'product_variant.product_id = product.product_id') | 225 | ->innerJoin('product_variant', 'product_variant.product_id = product.product_id') |
227 | - ->innerJoin('tax_value_string', 'tax_value_string.tax_option_id = tax_option.tax_option_id') | ||
228 | ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id') | 226 | ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id') |
229 | ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id]) | 227 | ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id]) |
230 | ->andWhere(['!=', 'product_variant.stock', 0]); | 228 | ->andWhere(['!=', 'product_variant.stock', 0]); |
@@ -234,14 +232,13 @@ class Category extends \yii\db\ActiveRecord | @@ -234,14 +232,13 @@ class Category extends \yii\db\ActiveRecord | ||
234 | 'tax_group.*', | 232 | 'tax_group.*', |
235 | 'tax_option.alias as option_alias', | 233 | 'tax_option.alias as option_alias', |
236 | 'tax_group.alias as group_alias', | 234 | 'tax_group.alias as group_alias', |
237 | - 'tax_value_string.value as value', | 235 | + 'tax_option.name as value', |
238 | 'tax_option.sort AS tax_option_sort', | 236 | 'tax_option.sort AS tax_option_sort', |
239 | 'tax_group.sort AS tax_group_sort', | 237 | 'tax_group.sort AS tax_group_sort', |
240 | ]) | 238 | ]) |
241 | ->from(['tax_option' ]) | 239 | ->from(['tax_option' ]) |
242 | ->where(['tax_option.tax_option_id'=>$query1->union($query2)]) | 240 | ->where(['tax_option.tax_option_id'=>$query1->union($query2)]) |
243 | ->innerJoin('tax_group','tax_group.tax_group_id = tax_option.tax_group_id') | 241 | ->innerJoin('tax_group','tax_group.tax_group_id = tax_option.tax_group_id') |
244 | - ->innerJoin('tax_value_string', 'tax_value_string.tax_option_id = tax_option.tax_option_id') | ||
245 | ->orderBy('tax_option.sort, tax_group.sort'); | 242 | ->orderBy('tax_option.sort, tax_group.sort'); |
246 | return $query3; | 243 | return $query3; |
247 | } | 244 | } |
@@ -251,9 +248,8 @@ class Category extends \yii\db\ActiveRecord | @@ -251,9 +248,8 @@ class Category extends \yii\db\ActiveRecord | ||
251 | 248 | ||
252 | $connection = Yii::$app->getDb(); | 249 | $connection = Yii::$app->getDb(); |
253 | $command = $connection->createCommand(' | 250 | $command = $connection->createCommand(' |
254 | - SELECT ton.alias as option_alias, * | 251 | + SELECT ton.alias as option_alias,ton.name as value, * |
255 | FROM tax_option as ton | 252 | FROM tax_option as ton |
256 | - LEFT JOIN tax_value_string as tvs ON ton.tax_option_id = tvs.tax_option_id | ||
257 | RIGHT JOIN tax_group ON ton.tax_group_id = tax_group.tax_group_id | 253 | RIGHT JOIN tax_group ON ton.tax_group_id = tax_group.tax_group_id |
258 | RIGHT JOIN tax_group_to_category ON tax_group.tax_group_id = tax_group_to_category.tax_group_id | 254 | RIGHT JOIN tax_group_to_category ON tax_group.tax_group_id = tax_group_to_category.tax_group_id |
259 | WHERE ton.tax_option_id IN ( | 255 | WHERE ton.tax_option_id IN ( |
@@ -276,7 +272,7 @@ class Category extends \yii\db\ActiveRecord | @@ -276,7 +272,7 @@ class Category extends \yii\db\ActiveRecord | ||
276 | 272 | ||
277 | public function setTaxGroup($value) | 273 | public function setTaxGroup($value) |
278 | { | 274 | { |
279 | - return $this->tax_group = $value; | 275 | + return $this->taxgroup = $value; |
280 | } | 276 | } |
281 | 277 | ||
282 | public function getTaxGroup() | 278 | public function getTaxGroup() |
frontend/controllers/OrderController.php
@@ -118,11 +118,7 @@ | @@ -118,11 +118,7 @@ | ||
118 | 'basket' => $basket, | 118 | 'basket' => $basket, |
119 | ]); | 119 | ]); |
120 | } | 120 | } |
121 | - | ||
122 | - public function actionSuccess() | ||
123 | - { | ||
124 | - return $this->render('success'); | ||
125 | - } | 121 | + |
126 | 122 | ||
127 | public function actionQuick() | 123 | public function actionQuick() |
128 | { | 124 | { |
@@ -168,7 +164,14 @@ | @@ -168,7 +164,14 @@ | ||
168 | throw new InvalidConfigException('Товар не найден или не удалось загрузить данные о покупателе.'); | 164 | throw new InvalidConfigException('Товар не найден или не удалось загрузить данные о покупателе.'); |
169 | } | 165 | } |
170 | } | 166 | } |
171 | - | 167 | + |
168 | + | ||
169 | + public function actionSuccess() | ||
170 | + { | ||
171 | + return $this->render('success'); | ||
172 | + } | ||
173 | + | ||
174 | + | ||
172 | public function actionQuickBasket() | 175 | public function actionQuickBasket() |
173 | { | 176 | { |
174 | $response = \Yii::$app->response; | 177 | $response = \Yii::$app->response; |
frontend/views/catalog/_product_item.php
@@ -51,8 +51,7 @@ use yii\helpers\Url; | @@ -51,8 +51,7 @@ use yii\helpers\Url; | ||
51 | <?php if($model->variant->price_old){?> | 51 | <?php if($model->variant->price_old){?> |
52 | <div class="dlexfduinxipi"> | 52 | <div class="dlexfduinxipi"> |
53 | <span class="main"> | 53 | <span class="main"> |
54 | - <s><?= $model->variant->price_old ?> | ||
55 | - <span class="currency">грн</span><s> | 54 | + <s><?= $model->variant->price_old ?><span class="currency">грн</span></s> |
56 | </span> | 55 | </span> |
57 | </div> | 56 | </div> |
58 | <?php }?> | 57 | <?php }?> |
frontend/views/catalog/product.php
@@ -137,15 +137,25 @@ FlipclockAsset::register($this); | @@ -137,15 +137,25 @@ FlipclockAsset::register($this); | ||
137 | </div><!-- EOF Image part --> | 137 | </div><!-- EOF Image part --> |
138 | 138 | ||
139 | <!-- Info table --> | 139 | <!-- Info table --> |
140 | - | 140 | + <div class="event_info"> |
141 | + <div class="events"> | ||
142 | + <?php foreach($product->events as $event):?> | ||
143 | + <?php if(!empty($event->banner) && $event->isActive()):?> | ||
144 | + <?= Html::a(\common\components\artboximage\ArtboxImageHelper::getImage($event->getImageUrl('banner'), 'banner_list'),Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?> | ||
145 | + <?php endif; ?> | ||
146 | + <?php endforeach; ?> | ||
147 | + </div> | ||
148 | + </div> | ||
141 | <div class="info" style="height: auto; opacity: 1;"> | 149 | <div class="info" style="height: auto; opacity: 1;"> |
142 | - | 150 | + |
151 | + | ||
143 | <table class="info_table"> | 152 | <table class="info_table"> |
144 | <colgroup> | 153 | <colgroup> |
145 | <col style="width: 280px;"> | 154 | <col style="width: 280px;"> |
146 | <col style="width: 35px;"> | 155 | <col style="width: 35px;"> |
147 | <col> | 156 | <col> |
148 | </colgroup> | 157 | </colgroup> |
158 | + | ||
149 | <tbody> | 159 | <tbody> |
150 | <tr> | 160 | <tr> |
151 | <?php foreach($product->events as $event):?> | 161 | <?php foreach($product->events as $event):?> |
@@ -267,6 +277,7 @@ FlipclockAsset::register($this); | @@ -267,6 +277,7 @@ FlipclockAsset::register($this); | ||
267 | </tr> | 277 | </tr> |
268 | <tr> | 278 | <tr> |
269 | <td class="price_block"> | 279 | <td class="price_block"> |
280 | + | ||
270 | <div class="price_block_container"> | 281 | <div class="price_block_container"> |
271 | 282 | ||
272 | 283 | ||
@@ -405,13 +416,7 @@ FlipclockAsset::register($this); | @@ -405,13 +416,7 @@ FlipclockAsset::register($this); | ||
405 | 416 | ||
406 | 417 | ||
407 | <div class="detail_tabs_content"> | 418 | <div class="detail_tabs_content"> |
408 | - <div class="events"> | ||
409 | - <?php foreach($product->events as $event):?> | ||
410 | - <?php if(!empty($event->banner) && $event->isActive()):?> | ||
411 | - <?= Html::a(\common\components\artboximage\ArtboxImageHelper::getImage($event->getImageUrl('banner'), 'event_in_product'),Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?> | ||
412 | - <?php endif; ?> | ||
413 | - <?php endforeach; ?> | ||
414 | - </div> | 419 | + |
415 | <div class="clear properties tab_div"> | 420 | <div class="clear properties tab_div"> |
416 | <h2 id="characteristics"> | 421 | <h2 id="characteristics"> |
417 | Характеристики <?= $product->name ?> | 422 | Характеристики <?= $product->name ?> |
frontend/views/catalog/products.php
@@ -8,11 +8,16 @@ use frontend\widgets\Seo; | @@ -8,11 +8,16 @@ use frontend\widgets\Seo; | ||
8 | use yii\helpers\Url; | 8 | use yii\helpers\Url; |
9 | use yii\web\View; | 9 | use yii\web\View; |
10 | use yii\widgets\ListView; | 10 | use yii\widgets\ListView; |
11 | + | ||
12 | + | ||
11 | $this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : ''; | 13 | $this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : ''; |
12 | 14 | ||
13 | $this->params['seo']['fields']['meta-title'] = $category->meta_title; | 15 | $this->params['seo']['fields']['meta-title'] = $category->meta_title; |
14 | $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name; | 16 | $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name; |
15 | $this->params['seo']['seo_text'] = $category->seo_text; | 17 | $this->params['seo']['seo_text'] = $category->seo_text; |
18 | + | ||
19 | + | ||
20 | + | ||
16 | $this->params['seo']['description'] = $category->meta_desc; | 21 | $this->params['seo']['description'] = $category->meta_desc; |
17 | $this->params['seo']['meta'] = $category->meta_robots; | 22 | $this->params['seo']['meta'] = $category->meta_robots; |
18 | $this->params['seo']['category_name'] = $category->name; | 23 | $this->params['seo']['category_name'] = $category->name; |
frontend/views/event/show.php
@@ -58,10 +58,13 @@ $this->title = $model->name; | @@ -58,10 +58,13 @@ $this->title = $model->name; | ||
58 | ?> | 58 | ?> |
59 | </div> | 59 | </div> |
60 | 60 | ||
61 | + <div class="body_view"> | ||
61 | <?=$model->body?> | 62 | <?=$model->body?> |
63 | + </div> | ||
64 | + | ||
62 | 65 | ||
63 | 66 | ||
64 | - <div class="block-75" itemscope itemtype="http://schema.org/Product"> | 67 | + <div class="block-100" itemscope itemtype="http://schema.org/Product"> |
65 | 68 | ||
66 | <div class="catalog_product_list view_table"> | 69 | <div class="catalog_product_list view_table"> |
67 | 70 |
frontend/views/layouts/main.php
@@ -63,7 +63,7 @@ use common\models\Event; | @@ -63,7 +63,7 @@ use common\models\Event; | ||
63 | </head> | 63 | </head> |
64 | <?php $this->beginBody() ?> | 64 | <?php $this->beginBody() ?> |
65 | <body> | 65 | <body> |
66 | - | 66 | + |
67 | 67 | ||
68 | <div class="wraper"> | 68 | <div class="wraper"> |
69 | <div class="border"> | 69 | <div class="border"> |
@@ -422,8 +422,8 @@ use common\models\Event; | @@ -422,8 +422,8 @@ use common\models\Event; | ||
422 | </div> | 422 | </div> |
423 | </footer> | 423 | </footer> |
424 | 424 | ||
425 | - <div class="btn-fixeds fixed-events"><a href="#">акции</a></div> | ||
426 | - <div class="btn-fixeds fixed-sale"><a href="#">Распродажа</a></div> | 425 | + <div class="btn-fixeds fixed-events"><a href="/event">акции</a></div> |
426 | +<!-- <div class="btn-fixeds fixed-sale"><a href="/event">Распродажа</a></div>--> | ||
427 | 427 | ||
428 | <table border="0" cellspacing="0" cellpadding="0" class="reqsBox"> | 428 | <table border="0" cellspacing="0" cellpadding="0" class="reqsBox"> |
429 | </table> | 429 | </table> |
@@ -446,12 +446,7 @@ use common\models\Event; | @@ -446,12 +446,7 @@ use common\models\Event; | ||
446 | <div class="modal fade" id="price_drop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3"> | 446 | <div class="modal fade" id="price_drop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3"> |
447 | <div class="modal-dialog auth" role="document"> | 447 | <div class="modal-dialog auth" role="document"> |
448 | <div class="modal-content"> | 448 | <div class="modal-content"> |
449 | - | ||
450 | - <div class="modal-header"> | ||
451 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
452 | - <span aria-hidden="true">×</span></button> | ||
453 | - <h4 class="modal-title" id="myModalLabel2">Узнать о снижении цены</h4> | ||
454 | - </div> | 449 | + |
455 | 450 | ||
456 | <div class="modal-body"> | 451 | <div class="modal-body"> |
457 | 452 | ||
@@ -492,7 +487,7 @@ use common\models\Event; | @@ -492,7 +487,7 @@ use common\models\Event; | ||
492 | <div class="modal-header"> | 487 | <div class="modal-header"> |
493 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | 488 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
494 | <span aria-hidden="true">×</span></button> | 489 | <span aria-hidden="true">×</span></button> |
495 | - <h4 class="modal-title" id="myModalLabel4">Где купить?</h4> | 490 | + <span class="modal-title" id="myModalLabel4">Где купить?</span> |
496 | </div> | 491 | </div> |
497 | 492 | ||
498 | <div class="modal-body" style="text-transform:uppercase"> | 493 | <div class="modal-body" style="text-transform:uppercase"> |
@@ -515,7 +510,7 @@ use common\models\Event; | @@ -515,7 +510,7 @@ use common\models\Event; | ||
515 | <div class="modal-header"> | 510 | <div class="modal-header"> |
516 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | 511 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
517 | <span aria-hidden="true">×</span></button> | 512 | <span aria-hidden="true">×</span></button> |
518 | - <h4 class="modal-title" id="myModalLabel4">Можно ли вернуть или обменять товар, если он мне не подошел?</h4> | 513 | + <span class="modal-title" id="myModalLabel4">Можно ли вернуть или обменять товар, если он мне не подошел?</span> |
519 | </div> | 514 | </div> |
520 | 515 | ||
521 | <div class="modal-body"> | 516 | <div class="modal-body"> |
@@ -542,7 +537,7 @@ use common\models\Event; | @@ -542,7 +537,7 @@ use common\models\Event; | ||
542 | <div class="modal-header"> | 537 | <div class="modal-header"> |
543 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | 538 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
544 | <span aria-hidden="true">×</span></button> | 539 | <span aria-hidden="true">×</span></button> |
545 | - <h4 class="modal-title" id="myModalLabel">Товар добавлен в закладки</h4> | 540 | + <span class="modal-title" id="myModalLabel">Товар добавлен в закладки</span> |
546 | </div> | 541 | </div> |
547 | 542 | ||
548 | <div class="modal-body"> | 543 | <div class="modal-body"> |
frontend/views/modal/forgot_password_form_model_window.php
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | 4 | ||
5 | <div class="modal-header"> | 5 | <div class="modal-header"> |
6 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | 6 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
7 | - <h4 class="modal-title" id="myModalLabel2">Напомнить пароль</h4> | 7 | + <span class="modal-title" id="myModalLabel2">Напомнить пароль</span> |
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <div class="modal-body"> | 10 | <div class="modal-body"> |
frontend/views/modal/login_window_model_window.php
@@ -13,7 +13,7 @@ use yii\widgets\ActiveForm; | @@ -13,7 +13,7 @@ use yii\widgets\ActiveForm; | ||
13 | 13 | ||
14 | <div class="modal-header"> | 14 | <div class="modal-header"> |
15 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | 15 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
16 | - <h4 class="modal-title" id="myModalLabel">Вход в личный кабинет</h4> | 16 | + <span class="modal-title" id="myModalLabel">Вход в личный кабинет</span> |
17 | </div> | 17 | </div> |
18 | 18 | ||
19 | <div class="modal-body"> | 19 | <div class="modal-body"> |
frontend/views/modal/my_callback_modal_window.php
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <div class="modal-content"> | 14 | <div class="modal-content"> |
15 | <div class="modal-header"> | 15 | <div class="modal-header"> |
16 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | 16 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
17 | - <h4 class="modal-title" id="myModalLabel">Заказ обратного звонка</h4> | 17 | + <span class="modal-title" id="myModalLabel">Заказ обратного звонка</span> |
18 | </div> | 18 | </div> |
19 | <div class="modal-body"> | 19 | <div class="modal-body"> |
20 | <?php | 20 | <?php |
frontend/views/modal/registration_window_model_window.php
@@ -13,7 +13,7 @@ use yii\widgets\ActiveForm; | @@ -13,7 +13,7 @@ use yii\widgets\ActiveForm; | ||
13 | 13 | ||
14 | <div class="modal-header"> | 14 | <div class="modal-header"> |
15 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | 15 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
16 | - <h4 class="modal-title" id="myModalLabel2">Создание профиля</h4> | 16 | + <span class="modal-title" id="myModalLabel2">Создание профиля</span> |
17 | </div> | 17 | </div> |
18 | 18 | ||
19 | <div class="modal-body"> | 19 | <div class="modal-body"> |
frontend/views/order/index.php
@@ -38,106 +38,6 @@ use yii\web\View; | @@ -38,106 +38,6 @@ use yii\web\View; | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | - <table border="0" cellspacing="0" cellpadding="0" class="boxGen articleBox"> | ||
42 | - <tbody><tr class="bxhead"> | ||
43 | - <th class="bxhl"></th> | ||
44 | - <th class="bxhc"><div class="h3"> | ||
45 | - <a href="view-articles/">Статьи</a> | ||
46 | - </div></th> | ||
47 | - | ||
48 | - <th class="bxhr"></th> | ||
49 | - </tr> | ||
50 | - | ||
51 | - <tr class="bxdelim"> | ||
52 | - <td></td> | ||
53 | - <td></td> | ||
54 | - <td></td> | ||
55 | - </tr> | ||
56 | - <tr class="bxmiddle"> | ||
57 | - <td class="bxl"></td> | ||
58 | - <td class="bxc"> <div width="100%" class="articlesBox"><!-- cats_table--> | ||
59 | - <div width="100%"> | ||
60 | - <div class="articleItem"> | ||
61 | - <span class="image"> | ||
62 | - </span> | ||
63 | - <span align="left" class="title"> | ||
64 | - <a href="liniya-sveta-predstavila-trendovye-modeli-na-interior-mebel-85.htm"> | ||
65 | - Линия света представила трендовые модели на Interior Mebel | ||
66 | - </a> | ||
67 | - </span> | ||
68 | - | ||
69 | - <div align="left" class="desc"> | ||
70 | - <p>В Киеве прошла выставка Interior Mebel, которая уже традиционно собирает лучшие образцы дизайна интерьера. На... | ||
71 | - <a href="liniya-sveta-predstavila-trendovye-modeli-na-interior-mebel-85.htm"> | ||
72 | - подробнее | ||
73 | - </a> | ||
74 | - </p></div> | ||
75 | - | ||
76 | - </div> | ||
77 | - | ||
78 | - | ||
79 | - <div class="articleItem"> | ||
80 | - <span class="image"> | ||
81 | - </span> | ||
82 | - <span align="left" class="title"> | ||
83 | - <a href="svetodiodnoe-osveschenie-light-topps-svetodiodnye-lampochki-lampy-colon-kupit-dlya-doma-ceny-v-ukraine-84.htm"> | ||
84 | - Светодиодное освещение Light Topps | Светодиодные... | ||
85 | - </a> | ||
86 | - </span> | ||
87 | - | ||
88 | - <div align="left" class="desc"> | ||
89 | - О светодиодных лампах и светильниках, в которых используются светодиодные модули, написано немало и наверняка уже... | ||
90 | - <a href="svetodiodnoe-osveschenie-light-topps-svetodiodnye-lampochki-lampy-colon-kupit-dlya-doma-ceny-v-ukraine-84.htm"> | ||
91 | - подробнее | ||
92 | - </a> | ||
93 | - </div> | ||
94 | - | ||
95 | - </div> | ||
96 | - | ||
97 | - | ||
98 | - <div class="articleItem"> | ||
99 | - <span class="image"> | ||
100 | - </span> | ||
101 | - <span align="left" class="title"> | ||
102 | - <a href="lyustry-potolochnye-novye-vozmojnosti-upravleniya-svetom-82.htm"> | ||
103 | - Люстры потолочные. Новые возможности управления светом | ||
104 | - </a> | ||
105 | - </span> | ||
106 | - | ||
107 | - <div align="left" class="desc"> | ||
108 | - Люстры потолочные оснащенные пультом дистанционного управления, позволяют включать/выключать, а также регулировать... | ||
109 | - <a href="lyustry-potolochnye-novye-vozmojnosti-upravleniya-svetom-82.htm"> | ||
110 | - подробнее | ||
111 | - </a> | ||
112 | - </div> | ||
113 | - | ||
114 | - </div> | ||
115 | - | ||
116 | - | ||
117 | - | ||
118 | - | ||
119 | - | ||
120 | - | ||
121 | - | ||
122 | - | ||
123 | - | ||
124 | - | ||
125 | - <div style="clear: left;"></div> | ||
126 | - | ||
127 | - | ||
128 | - </div> | ||
129 | - | ||
130 | - | ||
131 | - </div></td> | ||
132 | - <td class="bxr"></td> | ||
133 | - </tr> | ||
134 | - <tr class="bxbottom"> | ||
135 | - <td class="bxbl"></td> | ||
136 | - <td class="bxbc"></td> | ||
137 | - <td class="bxbr"></td> | ||
138 | - </tr> | ||
139 | - </tbody></table> | ||
140 | - | ||
141 | <div class="clearfix"></div> | 41 | <div class="clearfix"></div> |
142 | 42 | ||
143 | 43 |
frontend/views/order/success.php
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | <br><br> | 31 | <br><br> |
32 | <div align="center"> | 32 | <div align="center"> |
33 | <font size="+1">Спасибо за заказ!!</font><br><br> | 33 | <font size="+1">Спасибо за заказ!!</font><br><br> |
34 | - <a href="?p=start" style="display:inline">« На главную</a> | 34 | + <a href="/" style="display:inline">« На главную</a> |
35 | </div> | 35 | </div> |
36 | <!-- Google ECommerce Code --> | 36 | <!-- Google ECommerce Code --> |
37 | <script> | 37 | <script> |
frontend/views/site/index.php
frontend/web/css/css_header.css
@@ -14548,4 +14548,23 @@ ul.product-special li.promo div{ | @@ -14548,4 +14548,23 @@ ul.product-special li.promo div{ | ||
14548 | 14548 | ||
14549 | .banner-in-list{ | 14549 | .banner-in-list{ |
14550 | margin: 0 !important; | 14550 | margin: 0 !important; |
14551 | -} | ||
14552 | \ No newline at end of file | 14551 | \ No newline at end of file |
14552 | +} | ||
14553 | + | ||
14554 | +.event_info{ | ||
14555 | + position: relative; | ||
14556 | + float: left; | ||
14557 | +} | ||
14558 | +.event_info .events a{ | ||
14559 | + position: absolute; | ||
14560 | + left: -10px; | ||
14561 | + top: 80px; | ||
14562 | + display: inline; | ||
14563 | +} | ||
14564 | +.body_view{ | ||
14565 | + max-width: 1140px; | ||
14566 | + overflow: hidden; | ||
14567 | +} | ||
14568 | + | ||
14569 | +.block-100 .catalog_item{ | ||
14570 | + width: 25% !important; | ||
14571 | +} |
frontend/widgets/Seo.php
@@ -148,51 +148,14 @@ class Seo extends Widget | @@ -148,51 +148,14 @@ class Seo extends Widget | ||
148 | $filter = \Yii::$app->request->get('filters', []); | 148 | $filter = \Yii::$app->request->get('filters', []); |
149 | 149 | ||
150 | 150 | ||
151 | - $title = $this->selectSeoData(self::TITLE); | ||
152 | - | ||
153 | - | ||
154 | - if(!empty($filter) && isset($this->fields['meta-title']) && $title == $this->fields['meta-title']) { | ||
155 | - | ||
156 | - $array = [ | ||
157 | - 'category' => $this->category_name | ||
158 | - ]; | ||
159 | - | ||
160 | - | ||
161 | - if (isset($filter['brands']) && count($filter['brands']) == 1) { | ||
162 | - $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one(); | ||
163 | - if(!$model instanceof Brand){ | ||
164 | - | ||
165 | - \Yii::$app->response->redirect(['/site/error'],404); | ||
166 | - } else { | ||
167 | - $array['brand'] = $model->name; | ||
168 | - } | ||
169 | - | ||
170 | - } | ||
171 | - | ||
172 | - | ||
173 | - $optionsList = ArrayHelper::getColumn(TaxGroup::find()->where(['is_filter' => 'TRUE'])->all(),'alias'); | ||
174 | - | ||
175 | - | ||
176 | - foreach($optionsList as $optionList){ | ||
177 | - | ||
178 | - | ||
179 | - if (isset($filter[$optionList]) && count($filter[$optionList]) == 1) { | ||
180 | - | ||
181 | - $model = TaxOption::find()->where(['alias' =>$filter[$optionList]])->one(); | ||
182 | - if(!$model instanceof TaxOption){ | ||
183 | - | ||
184 | - \Yii::$app->response->redirect(['site/error'],404); | ||
185 | - } else { | ||
186 | - $array[$optionList] = $model->value->value; | ||
187 | - } | ||
188 | 151 | ||
189 | 152 | ||
190 | - | ||
191 | - } | ||
192 | - | 153 | + $title = $this->selectSeoData(self::TITLE); |
193 | 154 | ||
194 | 155 | ||
195 | - } | 156 | +// if(!empty($filter) && isset($this->fields['meta-title']) && $title == $this->fields['meta-title']) { |
157 | + if(!empty($filter)) { | ||
158 | + $array = $this->arrayBuilder($filter); | ||
196 | 159 | ||
197 | $title_string = $this->getTitleString($array); | 160 | $title_string = $this->getTitleString($array); |
198 | 161 | ||
@@ -219,6 +182,14 @@ class Seo extends Widget | @@ -219,6 +182,14 @@ class Seo extends Widget | ||
219 | 'content' => $description | 182 | 'content' => $description |
220 | ]); | 183 | ]); |
221 | 184 | ||
185 | + } else { | ||
186 | + | ||
187 | + $filter = \Yii::$app->request->get('filters', []); | ||
188 | + if(!empty($filter)){ | ||
189 | + $array = $this->arrayBuilder($filter); | ||
190 | + return $this->getDescriptionString($array); | ||
191 | + } | ||
192 | + | ||
222 | } | 193 | } |
223 | 194 | ||
224 | break; | 195 | break; |
@@ -265,7 +236,7 @@ class Seo extends Widget | @@ -265,7 +236,7 @@ class Seo extends Widget | ||
265 | ) { | 236 | ) { |
266 | $this->getView()->registerMetaTag([ | 237 | $this->getView()->registerMetaTag([ |
267 | 'name' => 'robots', | 238 | 'name' => 'robots', |
268 | - 'content' => 'noindex,follow' | 239 | + 'content' => 'noindex,nofollow' |
269 | ]); | 240 | ]); |
270 | } else { | 241 | } else { |
271 | 242 | ||
@@ -366,17 +337,112 @@ class Seo extends Widget | @@ -366,17 +337,112 @@ class Seo extends Widget | ||
366 | } | 337 | } |
367 | 338 | ||
368 | public function getTitleString($array){ | 339 | public function getTitleString($array){ |
340 | + $row = "{Название раздела: Название блока фильтра: Фильтр 1 | Название блока фильтра: Фильтр 2 | Название блока фильтра: Фильтр 3} - купить в Киеве, Украине - интернет магазин Лінія Світла"; | ||
341 | + $row = ''; | ||
342 | + foreach($array as $name => $field){ | ||
343 | + | ||
344 | + if($name == 'category' ){ | ||
345 | + $row = $field.': '.$row; | ||
346 | + } else { | ||
347 | + $row .= $field['name'] .' '.$field['value'].' |' ; | ||
348 | + } | ||
349 | + | ||
350 | + | ||
351 | + | ||
352 | + } | ||
353 | + $row = substr($row, 0,-1 ); | ||
354 | + $row .= " - купить в Киеве, Украине - интернет магазин Лінія Світла"; | ||
355 | + return $row; | ||
356 | +// $template = SeoDynamic::find()->select('title')->where(['param' =>'filters'])->one(); | ||
357 | +// if($template instanceof SeoDynamic){ | ||
358 | +// foreach ($array as $field_name => $field_value) { | ||
359 | +// $template->title = str_replace('{' . $field_name . '}', mb_strtolower($field_value), $template->title); | ||
360 | +// } | ||
361 | +// $template = preg_replace('/\{.[^\}]*\}\s/','',$template->title); | ||
362 | +// return $template; | ||
363 | +// } | ||
364 | +// | ||
365 | +// return false; | ||
366 | + | ||
367 | + } | ||
368 | + | ||
369 | + | ||
370 | + public function getDescriptionString($array){ | ||
371 | + $row = "Лучшие цены на {Название раздела: Название блока фильтра: Фильтр 1 | Название блока фильтра: Фильтр 2 | Название блока фильтра: Фильтр 3}. Лінія Світла"; | ||
372 | + $row = 'Лучшие цены на '; | ||
373 | + foreach($array as $name => $field){ | ||
369 | 374 | ||
370 | - $template = SeoDynamic::find()->select('title')->where(['param' =>'filters'])->one(); | ||
371 | - if($template instanceof SeoDynamic){ | ||
372 | - foreach ($array as $field_name => $field_value) { | ||
373 | - $template->title = str_replace('{' . $field_name . '}', mb_strtolower($field_value), $template->title); | 375 | + if($name == 'category' ){ |
376 | + $row = $field.': '.$row; | ||
377 | + } else { | ||
378 | + $row .= $field['name'] .' '.$field['value'].' |' ; | ||
374 | } | 379 | } |
375 | - $template = preg_replace('/\{.[^\}]*\}\s/','',$template->title); | ||
376 | - return $template; | 380 | + |
381 | + | ||
382 | + | ||
377 | } | 383 | } |
384 | + $row = substr($row, 0,-1 ); | ||
385 | + $row .= ". Лінія Світла"; | ||
386 | + return $row; | ||
387 | +// $template = SeoDynamic::find()->select('title')->where(['param' =>'filters'])->one(); | ||
388 | +// if($template instanceof SeoDynamic){ | ||
389 | +// foreach ($array as $field_name => $field_value) { | ||
390 | +// $template->title = str_replace('{' . $field_name . '}', mb_strtolower($field_value), $template->title); | ||
391 | +// } | ||
392 | +// $template = preg_replace('/\{.[^\}]*\}\s/','',$template->title); | ||
393 | +// return $template; | ||
394 | +// } | ||
395 | +// | ||
396 | +// return false; | ||
397 | + | ||
398 | + } | ||
399 | + | ||
400 | + | ||
401 | + public function arrayBuilder($filter) | ||
402 | + { | ||
403 | + | ||
404 | + $array = [ | ||
405 | + 'category' => $this->category_name | ||
406 | + ]; | ||
407 | + | ||
408 | + | ||
409 | + if (isset($filter['brands']) && count($filter['brands']) == 1) { | ||
410 | + $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one(); | ||
411 | + if (!$model instanceof Brand) { | ||
412 | + | ||
413 | + \Yii::$app->response->redirect(['/site/error'], 404); | ||
414 | + } else { | ||
415 | + $array['brand']['name'] = 'Бренд'; | ||
416 | + $array['brand']['value'] = $model->name; | ||
417 | + } | ||
418 | + | ||
419 | + } | ||
420 | + | ||
421 | + | ||
422 | + $optionsList = ArrayHelper::map(TaxGroup::find()->where(['is_filter' => 'TRUE'])->all(), 'alias', 'name'); | ||
423 | + | ||
424 | + | ||
425 | + foreach ($optionsList as $optionList => $name) { | ||
426 | + | ||
427 | + | ||
428 | + if (isset($filter[$optionList]) && count($filter[$optionList]) == 1) { | ||
429 | + | ||
430 | + $model = TaxOption::find()->where(['alias' => $filter[$optionList]])->one(); | ||
431 | + if (!$model instanceof TaxOption) { | ||
432 | + | ||
433 | + \Yii::$app->response->redirect(['site/error'], 404); | ||
434 | + } else { | ||
435 | + $array[$optionList]['value'] = $model->value; | ||
436 | + $array[$optionList]['name'] = $name; | ||
437 | + } | ||
438 | + | ||
439 | + | ||
440 | + } | ||
441 | + | ||
442 | + | ||
443 | + } | ||
378 | 444 | ||
379 | - return false; | 445 | + return $array; |
380 | 446 | ||
381 | } | 447 | } |
382 | 448 |