Commit e89230053afb05e5c18762a86d3f7197b9c64c85
1 parent
30ea8a35
29.06.16
Showing
4 changed files
with
66 additions
and
43 deletions
Show diff stats
common/modules/product/models/Category.php
... | ... | @@ -165,13 +165,12 @@ class Category extends \yii\db\ActiveRecord |
165 | 165 | return $this->getRelations('tax_group_to_category'); |
166 | 166 | } |
167 | 167 | |
168 | -// public function getTaxGroupsByLevel($level) | |
169 | -// { | |
170 | -// return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ]) | |
171 | -// ->viaTable('portfolio_specialization', [ 'portfolio_id' => 'portfolio_id' ]); | |
172 | -// | |
173 | -// return $this->hasMany(ProductCategory::className(), ['category_id' => 'category_id'])->with(TaxGroup::tableName())->where(['level' => $level]); | |
174 | -// } | |
168 | + public function getTaxGroupsByLevel($level) | |
169 | + { | |
170 | + return $this->hasMany(TaxGroup::className(), ['tax_group_id' => 'entity1_id']) | |
171 | + ->viaTable('relation', ['entity2_id' => 'category_id']) | |
172 | + ->andWhere(['level' => $level]); | |
173 | + } | |
175 | 174 | |
176 | 175 | public function getRemote_category() |
177 | 176 | { | ... | ... |
common/modules/product/views/variant/_form.php
... | ... | @@ -28,7 +28,6 @@ use kartik\select2\Select2; |
28 | 28 | <?= $form->field($model, 'sku')->textarea(); ?> |
29 | 29 | <?= $form->field($model, 'price')->textarea(); ?> |
30 | 30 | <?= $form->field($model, 'price_old')->textarea(); ?> |
31 | - <?php var_dump($model->imageUrl)?> | |
32 | 31 | <?= $form->field($model, 'image')->widget(\kartik\file\FileInput::classname(), [ |
33 | 32 | 'model' => $model, |
34 | 33 | 'attribute' => 'image', | ... | ... |
common/modules/rubrication/models/TaxOption.php
... | ... | @@ -69,7 +69,7 @@ class TaxOption extends \yii\db\ActiveRecord |
69 | 69 | { |
70 | 70 | return [ |
71 | 71 | [['tax_group_id'], 'required'], |
72 | - [['tax_group_id', 'level', 'parent_id', 'sort', 'default_value'], 'integer'], | |
72 | + [['tax_group_id', 'parent_id', 'sort', 'default_value'], 'integer'], | |
73 | 73 | [['alias'], 'string', 'max' => 50], |
74 | 74 | [['tax_group_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxGroup::className(), 'targetAttribute' => ['tax_group_id' => 'tax_group_id']], |
75 | 75 | // [['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['parent_id' => 'tax_option_id']], | ... | ... |
frontend/widgets/Seo.php
... | ... | @@ -190,55 +190,80 @@ class Seo extends Widget |
190 | 190 | |
191 | 191 | break; |
192 | 192 | case self::META: |
193 | + | |
193 | 194 | $meta = $this->selectSeoData(self::META); |
194 | 195 | |
195 | 196 | $filter = \Yii::$app->request->get('filter', []); |
196 | 197 | $sort = \Yii::$app->request->get('sort', []); |
197 | 198 | $paginate = \Yii::$app->request->get('page', []); |
198 | - if (!empty($meta)) { | |
199 | 199 | |
200 | - $this->getView()->registerMetaTag([ | |
201 | - 'name' => 'robots', | |
202 | - 'content' => $meta | |
203 | - ]); | |
200 | + $array = ['%21','%22','%23','%24','%25','%26','%27','%28','%29','%2A','%2B','%2C','%2D','%2E','%2F','%3A','%3B','%3C','%3D','%3E','%3F','%40','%5B','%5C','%5D','%5E','%5F','%60','%7B','%7C','%7D','%7E',]; | |
201 | + $url = \Yii::$app->request->url; | |
204 | 202 | |
205 | - } else if(!empty($filter['special'])){ | |
203 | + $continue = true; | |
206 | 204 | |
207 | - $this->getView()->registerMetaTag([ | |
208 | - 'name' => 'robots', | |
209 | - 'content' => 'noindex,follow' | |
210 | - ]); | |
205 | + foreach($array as $sym){ | |
206 | + if(strpos(mb_strtolower ($url), mb_strtolower ($sym))){ | |
207 | + $this->getView()->registerMetaTag([ | |
208 | + 'name' => 'robots', | |
209 | + 'content' => 'noindex,nofollow' | |
210 | + ]); | |
211 | 211 | |
212 | - } else if ( | |
213 | - isset($filter['brands']) && count($filter['brands']) > 1 | |
214 | - || isset($filter['options']["pol"]) && count($filter['options']["pol"]) > 1 | |
215 | - || isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) > 1 | |
216 | - || isset($filter['options']["god"]) && count($filter['options']["god"]) > 1 | |
212 | + $continue = false; | |
213 | + break; | |
217 | 214 | |
218 | - ) { | |
219 | - $this->getView()->registerMetaTag([ | |
220 | - 'name' => 'robots', | |
221 | - 'content' => 'noindex,nofollow' | |
222 | - ]); | |
215 | + } | |
216 | + } | |
223 | 217 | |
224 | - } else if ( | |
225 | - isset($filter['brands']) && count($filter['brands']) <= 1 && isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) >= 4 | |
226 | - || isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) > 4 | |
227 | - || !empty($sort) || !empty($paginate) || isset($filter['prices']) | |
228 | - ) { | |
229 | - $this->getView()->registerMetaTag([ | |
230 | - 'name' => 'robots', | |
231 | - 'content' => 'noindex,follow' | |
232 | - ]); | |
233 | - } else { | |
234 | 218 | |
235 | - $this->getView()->registerMetaTag([ | |
236 | - 'name' => 'robots', | |
237 | - 'content' => 'index,follow' | |
238 | - ]); | |
219 | + if($continue){ | |
220 | + if (!empty($meta)) { | |
221 | + | |
222 | + $this->getView()->registerMetaTag([ | |
223 | + 'name' => 'robots', | |
224 | + 'content' => $meta | |
225 | + ]); | |
226 | + | |
227 | + } else if(!empty($filter['special'])){ | |
228 | + | |
229 | + $this->getView()->registerMetaTag([ | |
230 | + 'name' => 'robots', | |
231 | + 'content' => 'noindex,follow' | |
232 | + ]); | |
233 | + | |
234 | + } else if ( | |
235 | + isset($filter['brands']) && count($filter['brands']) > 1 | |
236 | + || isset($filter['options']["pol"]) && count($filter['options']["pol"]) > 1 | |
237 | + || isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) > 1 | |
238 | + || isset($filter['options']["god"]) && count($filter['options']["god"]) > 1 | |
239 | + | |
240 | + ) { | |
241 | + $this->getView()->registerMetaTag([ | |
242 | + 'name' => 'robots', | |
243 | + 'content' => 'noindex,nofollow' | |
244 | + ]); | |
245 | + | |
246 | + } else if ( | |
247 | + isset($filter['brands']) && count($filter['brands']) <= 1 && isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) >= 4 | |
248 | + || isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) > 4 | |
249 | + || !empty($sort) || !empty($paginate) || isset($filter['prices']) | |
250 | + ) { | |
251 | + $this->getView()->registerMetaTag([ | |
252 | + 'name' => 'robots', | |
253 | + 'content' => 'noindex,follow' | |
254 | + ]); | |
255 | + } else { | |
256 | + | |
257 | + $this->getView()->registerMetaTag([ | |
258 | + 'name' => 'robots', | |
259 | + 'content' => 'index,follow' | |
260 | + ]); | |
261 | + } | |
239 | 262 | } |
240 | 263 | |
241 | 264 | |
265 | + | |
266 | + | |
242 | 267 | break; |
243 | 268 | } |
244 | 269 | ... | ... |