diff --git a/backend/controllers/SeoDynamicController.php b/backend/controllers/SeoDynamicController.php index e6edd30..ba243a9 100644 --- a/backend/controllers/SeoDynamicController.php +++ b/backend/controllers/SeoDynamicController.php @@ -36,7 +36,7 @@ class SeoDynamicController extends Controller public function actionIndex($seo_category_id) { $searchModel = new SeoDynamicSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + $dataProvider = $searchModel->search($seo_category_id,Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, diff --git a/backend/views/seo-dynamic/_form.php b/backend/views/seo-dynamic/_form.php index fd26945..9f8d22e 100644 --- a/backend/views/seo-dynamic/_form.php +++ b/backend/views/seo-dynamic/_form.php @@ -16,6 +16,10 @@ use yii\widgets\ActiveForm; field($model, 'action')->textInput(['maxlength' => true]) ?> + field($model, 'param')->textInput(['maxlength' => true]) ?> + + field($model, 'key')->textInput(['maxlength' => true]) ?> + field($model, 'fields')->textInput(['maxlength' => true]) ?> field($model, 'title')->textInput(['maxlength' => true]) ?> diff --git a/common/models/SeoDynamic.php b/common/models/SeoDynamic.php index 167fb5a..54f9a6a 100644 --- a/common/models/SeoDynamic.php +++ b/common/models/SeoDynamic.php @@ -15,8 +15,10 @@ use Yii; * @property string $title * @property string $h1 * @property string $description - * @property string $seo-text + * @property string $seo_text * @property integer $status + * @property string $param + * @property string $key * * @property SeoCategory $seoCategory */ @@ -39,7 +41,7 @@ class SeoDynamic extends \yii\db\ActiveRecord [['seo_category_id', 'status'], 'integer'], [['seo_text'], 'string'], [['name', 'action'], 'string', 'max' => 200], - [['fields', 'title', 'h1', 'description'], 'string', 'max' => 255], + [['fields', 'title', 'h1', 'description', 'param', 'key'], 'string', 'max' => 255], [['seo_category_id'], 'exist', 'skipOnError' => true, 'targetClass' => SeoCategory::className(), 'targetAttribute' => ['seo_category_id' => 'seo_category_id']], ]; } @@ -60,6 +62,8 @@ class SeoDynamic extends \yii\db\ActiveRecord 'description' => Yii::t('app', 'Description'), 'seo_text' => Yii::t('app', 'Seo Text'), 'status' => Yii::t('app', 'Status'), + 'param' => Yii::t('app', 'Param'), + 'key' => Yii::t('app', 'Key'), ]; } diff --git a/common/models/SeoDynamicSearch.php b/common/models/SeoDynamicSearch.php index 4d9ade6..ce0d978 100644 --- a/common/models/SeoDynamicSearch.php +++ b/common/models/SeoDynamicSearch.php @@ -39,7 +39,7 @@ class SeoDynamicSearch extends SeoDynamic * * @return ActiveDataProvider */ - public function search($params) + public function search($seo_category_id, $params) { $query = SeoDynamic::find(); @@ -60,7 +60,7 @@ class SeoDynamicSearch extends SeoDynamic // grid filtering conditions $query->andFilterWhere([ 'seo_dynamic_id' => $this->seo_dynamic_id, - 'seo_category_id' => $this->seo_category_id, + 'seo_category_id' => $seo_category_id, 'status' => $this->status, ]); diff --git a/console/migrations/m160414_101644_add_param_to_seo_dynamic.php b/console/migrations/m160414_101644_add_param_to_seo_dynamic.php new file mode 100644 index 0000000..59d896f --- /dev/null +++ b/console/migrations/m160414_101644_add_param_to_seo_dynamic.php @@ -0,0 +1,26 @@ +addColumn('seo_dynamic', 'param', $this->string()); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropColumn('seo_dynamic', 'param'); + } +} diff --git a/console/migrations/m160414_214745_add_key_to_seo_dynamic.php b/console/migrations/m160414_214745_add_key_to_seo_dynamic.php new file mode 100644 index 0000000..14780b1 --- /dev/null +++ b/console/migrations/m160414_214745_add_key_to_seo_dynamic.php @@ -0,0 +1,26 @@ +addColumn('seo_dynamic', 'key', $this->string()); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropColumn('seo_dynamic', 'key'); + } +} diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index 9b5d9da..d0029d6 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -1,7 +1,7 @@ title = $product->name; foreach($product->category->getParents()->all() as $parent) { $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]]; diff --git a/frontend/views/catalog/products.php b/frontend/views/catalog/products.php index e725186..347835c 100755 --- a/frontend/views/catalog/products.php +++ b/frontend/views/catalog/products.php @@ -3,14 +3,21 @@ /** @var $productProvider \yii\data\ActiveDataProvider */ /** @var $brandProvider \yii\data\ActiveDataProvider */ + use yii\helpers\Url; use common\modules\product\helpers\ProductHelper; + $this->title = $category->categoryName->value; foreach($category->getParents()->all() as $parent) { $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]]; } $this->params['breadcrumbs'][] = $category->categoryName->value; +$this->params['seo']['seo_text'] = 'TEST SEO TEXT'; +$this->params['seo']['h1'] = 'TEST H1'; +$this->params['seo']['description'] = 'TEST DESCRIPTION'; +$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD'; +$this->params['seo']['key']= 'product_list'; ?>