diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php index 880f5cd..8cac0cd 100755 --- a/common/modules/product/models/Category.php +++ b/common/modules/product/models/Category.php @@ -165,13 +165,12 @@ class Category extends \yii\db\ActiveRecord return $this->getRelations('tax_group_to_category'); } -// public function getTaxGroupsByLevel($level) -// { -// return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ]) -// ->viaTable('portfolio_specialization', [ 'portfolio_id' => 'portfolio_id' ]); -// -// return $this->hasMany(ProductCategory::className(), ['category_id' => 'category_id'])->with(TaxGroup::tableName())->where(['level' => $level]); -// } + public function getTaxGroupsByLevel($level) + { + return $this->hasMany(TaxGroup::className(), ['tax_group_id' => 'entity1_id']) + ->viaTable('relation', ['entity2_id' => 'category_id']) + ->andWhere(['level' => $level]); + } public function getRemote_category() { diff --git a/common/modules/product/views/variant/_form.php b/common/modules/product/views/variant/_form.php index 5e8cc89..d771b83 100644 --- a/common/modules/product/views/variant/_form.php +++ b/common/modules/product/views/variant/_form.php @@ -28,7 +28,6 @@ use kartik\select2\Select2; field($model, 'sku')->textarea(); ?> field($model, 'price')->textarea(); ?> field($model, 'price_old')->textarea(); ?> - imageUrl)?> field($model, 'image')->widget(\kartik\file\FileInput::classname(), [ 'model' => $model, 'attribute' => 'image', diff --git a/common/modules/rubrication/models/TaxOption.php b/common/modules/rubrication/models/TaxOption.php index 8313a7c..a5f1404 100755 --- a/common/modules/rubrication/models/TaxOption.php +++ b/common/modules/rubrication/models/TaxOption.php @@ -69,7 +69,7 @@ class TaxOption extends \yii\db\ActiveRecord { return [ [['tax_group_id'], 'required'], - [['tax_group_id', 'level', 'parent_id', 'sort', 'default_value'], 'integer'], + [['tax_group_id', 'parent_id', 'sort', 'default_value'], 'integer'], [['alias'], 'string', 'max' => 50], [['tax_group_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxGroup::className(), 'targetAttribute' => ['tax_group_id' => 'tax_group_id']], // [['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['parent_id' => 'tax_option_id']], diff --git a/frontend/widgets/Seo.php b/frontend/widgets/Seo.php index 039913d..626c8ad 100755 --- a/frontend/widgets/Seo.php +++ b/frontend/widgets/Seo.php @@ -190,55 +190,80 @@ class Seo extends Widget break; case self::META: + $meta = $this->selectSeoData(self::META); $filter = \Yii::$app->request->get('filter', []); $sort = \Yii::$app->request->get('sort', []); $paginate = \Yii::$app->request->get('page', []); - if (!empty($meta)) { - $this->getView()->registerMetaTag([ - 'name' => 'robots', - 'content' => $meta - ]); + $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',]; + $url = \Yii::$app->request->url; - } else if(!empty($filter['special'])){ + $continue = true; - $this->getView()->registerMetaTag([ - 'name' => 'robots', - 'content' => 'noindex,follow' - ]); + foreach($array as $sym){ + if(strpos(mb_strtolower ($url), mb_strtolower ($sym))){ + $this->getView()->registerMetaTag([ + 'name' => 'robots', + 'content' => 'noindex,nofollow' + ]); - } else if ( - isset($filter['brands']) && count($filter['brands']) > 1 - || isset($filter['options']["pol"]) && count($filter['options']["pol"]) > 1 - || isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) > 1 - || isset($filter['options']["god"]) && count($filter['options']["god"]) > 1 + $continue = false; + break; - ) { - $this->getView()->registerMetaTag([ - 'name' => 'robots', - 'content' => 'noindex,nofollow' - ]); + } + } - } else if ( - isset($filter['brands']) && count($filter['brands']) <= 1 && isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) >= 4 - || isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) > 4 - || !empty($sort) || !empty($paginate) || isset($filter['prices']) - ) { - $this->getView()->registerMetaTag([ - 'name' => 'robots', - 'content' => 'noindex,follow' - ]); - } else { - $this->getView()->registerMetaTag([ - 'name' => 'robots', - 'content' => 'index,follow' - ]); + if($continue){ + if (!empty($meta)) { + + $this->getView()->registerMetaTag([ + 'name' => 'robots', + 'content' => $meta + ]); + + } else if(!empty($filter['special'])){ + + $this->getView()->registerMetaTag([ + 'name' => 'robots', + 'content' => 'noindex,follow' + ]); + + } else if ( + isset($filter['brands']) && count($filter['brands']) > 1 + || isset($filter['options']["pol"]) && count($filter['options']["pol"]) > 1 + || isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) > 1 + || isset($filter['options']["god"]) && count($filter['options']["god"]) > 1 + + ) { + $this->getView()->registerMetaTag([ + 'name' => 'robots', + 'content' => 'noindex,nofollow' + ]); + + } else if ( + isset($filter['brands']) && count($filter['brands']) <= 1 && isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) >= 4 + || isset($filter['options']) && count($filter['options'], COUNT_RECURSIVE) > 4 + || !empty($sort) || !empty($paginate) || isset($filter['prices']) + ) { + $this->getView()->registerMetaTag([ + 'name' => 'robots', + 'content' => 'noindex,follow' + ]); + } else { + + $this->getView()->registerMetaTag([ + 'name' => 'robots', + 'content' => 'index,follow' + ]); + } } + + break; } -- libgit2 0.21.4