Commit 01f58a2051df4e4ad9f4f154d2cbbef35ac6f5ac
Merge remote-tracking branch 'origin/master'
# Conflicts: # CatalogUrlManager.php
Showing
4 changed files
with
28 additions
and
17 deletions
Show diff stats
CatalogUrlManager.php
| ... | ... | @@ -148,18 +148,18 @@ |
| 148 | 148 | $product_alias = strtolower($params[ 'product' ]); |
| 149 | 149 | unset( $params[ 'product' ] ); |
| 150 | 150 | } |
| 151 | - | |
| 151 | + | |
| 152 | 152 | if (!empty( $params[ 'variant' ] )) { |
| 153 | 153 | $variant_sku = strtolower($params[ 'variant' ]); |
| 154 | 154 | unset( $params[ 'variant' ] ); |
| 155 | 155 | } |
| 156 | - | |
| 156 | + | |
| 157 | 157 | $url = 'product/' . $product_alias . '/' . $variant_sku; |
| 158 | - | |
| 158 | + | |
| 159 | 159 | if (!empty( $params ) && ( $query = http_build_query($params) ) !== '') { |
| 160 | 160 | $url .= '?' . $query; |
| 161 | 161 | } |
| 162 | - | |
| 162 | + | |
| 163 | 163 | return $url; |
| 164 | 164 | break; |
| 165 | 165 | ... | ... |
models/CategoryLang.php
| ... | ... | @@ -5,9 +5,10 @@ |
| 5 | 5 | use artweb\artbox\language\models\Language; |
| 6 | 6 | use Yii; |
| 7 | 7 | use yii\db\ActiveRecord; |
| 8 | - | |
| 8 | + | |
| 9 | 9 | /** |
| 10 | 10 | * This is the model class for table "category_lang". |
| 11 | + * | |
| 11 | 12 | * @property integer $category_id |
| 12 | 13 | * @property integer $language_id |
| 13 | 14 | * @property string $title |
| ... | ... | @@ -16,6 +17,7 @@ |
| 16 | 17 | * @property string $meta_description |
| 17 | 18 | * @property string $seo_text |
| 18 | 19 | * @property string $h1 |
| 20 | + * @property string $category_synonym | |
| 19 | 21 | * @property Category $category |
| 20 | 22 | * @property Language $language |
| 21 | 23 | */ |
| ... | ... | @@ -42,7 +44,7 @@ |
| 42 | 44 | { |
| 43 | 45 | return [ |
| 44 | 46 | 'slug' => [ |
| 45 | - 'class' => 'artweb\artbox\behaviors\Slug', | |
| 47 | + 'class' => 'artweb\artbox\behaviors\Slug', | |
| 46 | 48 | ], |
| 47 | 49 | ]; |
| 48 | 50 | } |
| ... | ... | @@ -66,6 +68,7 @@ |
| 66 | 68 | ], |
| 67 | 69 | [ |
| 68 | 70 | [ |
| 71 | + 'category_synonym', | |
| 69 | 72 | 'title', |
| 70 | 73 | 'meta_title', |
| 71 | 74 | 'meta_robots', |
| ... | ... | @@ -110,14 +113,15 @@ |
| 110 | 113 | public function attributeLabels() |
| 111 | 114 | { |
| 112 | 115 | return [ |
| 113 | - 'category_id' => Yii::t('app', 'Category ID'), | |
| 114 | - 'language_id' => Yii::t('app', 'Language ID'), | |
| 115 | - 'title' => Yii::t('app', 'Name'), | |
| 116 | - 'meta_title' => Yii::t('app', 'Meta Title'), | |
| 117 | - 'meta_robots' => Yii::t('app', 'Meta Robots'), | |
| 118 | - 'meta_description' => Yii::t('app', 'Meta Desc'), | |
| 119 | - 'seo_text' => Yii::t('app', 'Seo Text'), | |
| 120 | - 'h1' => Yii::t('app', 'H1'), | |
| 116 | + 'category_id' => Yii::t('app', 'Category ID'), | |
| 117 | + 'language_id' => Yii::t('app', 'Language ID'), | |
| 118 | + 'title' => Yii::t('app', 'Name'), | |
| 119 | + 'meta_title' => Yii::t('app', 'Meta Title'), | |
| 120 | + 'meta_robots' => Yii::t('app', 'Meta Robots'), | |
| 121 | + 'meta_description' => Yii::t('app', 'Meta Desc'), | |
| 122 | + 'seo_text' => Yii::t('app', 'Seo Text'), | |
| 123 | + 'h1' => Yii::t('app', 'H1'), | |
| 124 | + 'category_synonym' => Yii::t('app', 'Synonym') | |
| 121 | 125 | ]; |
| 122 | 126 | } |
| 123 | 127 | ... | ... |
models/Product.php
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | * @property TaxOption[] $filters |
| 40 | 40 | * @property ProductVariant[] $variantsWithFilters |
| 41 | 41 | * @property string $remote_id |
| 42 | - * @property string $fullname | |
| 42 | + * @property string $fullName | |
| 43 | 43 | * @property float $variantPrice |
| 44 | 44 | * @property float $enabledVariantPrice |
| 45 | 45 | * @property array $categoryNames |
| ... | ... | @@ -337,9 +337,13 @@ |
| 337 | 337 | * |
| 338 | 338 | * @return string |
| 339 | 339 | */ |
| 340 | - public function getFullname():string | |
| 340 | + public function getFullName():string | |
| 341 | 341 | { |
| 342 | - return empty( $this->brand ) ? $this->lang->title : $this->brand->lang->title . ' ' . $this->lang->title; | |
| 342 | + $name = ''; | |
| 343 | + if (!empty($this->category->lang->category_synonym)) $name = $name . $this->category->lang->category_synonym . ' '; | |
| 344 | + if (!empty($this->brand)) $name = $name . $this->brand->lang->title . ' '; | |
| 345 | + $name .= $this->lang->title; | |
| 346 | + return $name; | |
| 343 | 347 | } |
| 344 | 348 | |
| 345 | 349 | /** | ... | ... |
views/category/_form_language.php
| ... | ... | @@ -13,6 +13,9 @@ |
| 13 | 13 | ?> |
| 14 | 14 | <?= $form->field($model_lang, '[' . $language->id . ']title') |
| 15 | 15 | ->textInput([ 'maxlength' => true ]); ?> |
| 16 | + | |
| 17 | +<?= $form->field($model_lang, '[' . $language->id . ']category_synonym') | |
| 18 | + ->textInput([ 'maxlength' => true ]); ?> | |
| 16 | 19 | |
| 17 | 20 | <?= $form->field($model_lang, '[' . $language->id . ']alias') |
| 18 | 21 | ->textInput([ 'maxlength' => true ]); ?> | ... | ... |