Commit dbe48e8b010be099d7e97c67524aa1f1977b4aba
1 parent
852cc8d1
-Some fixes
Showing
4 changed files
with
32 additions
and
20 deletions
Show diff stats
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
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | * @property TaxOption[] $filters |
| 39 | 39 | * @property ProductVariant[] $variantsWithFilters |
| 40 | 40 | * @property string $remote_id |
| 41 | - * @property string $fullname | |
| 41 | + * @property string $fullName | |
| 42 | 42 | * @property float $variantPrice |
| 43 | 43 | * @property float $enabledVariantPrice |
| 44 | 44 | * @property array $categoryNames |
| ... | ... | @@ -315,9 +315,13 @@ |
| 315 | 315 | * |
| 316 | 316 | * @return string |
| 317 | 317 | */ |
| 318 | - public function getFullname():string | |
| 318 | + public function getFullName():string | |
| 319 | 319 | { |
| 320 | - return empty( $this->brand ) ? $this->lang->title : $this->brand->lang->title . ' ' . $this->lang->title; | |
| 320 | + $name = ''; | |
| 321 | + if (!empty($this->category->lang->category_synonym)) $name = $name . $this->category->lang->category_synonym . ' '; | |
| 322 | + if (!empty($this->brand)) $name = $name . $this->brand->lang->title . ' '; | |
| 323 | + $name .= $this->lang->title; | |
| 324 | + return $name; | |
| 321 | 325 | } |
| 322 | 326 | |
| 323 | 327 | /** | ... | ... |
views/category/_form.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use common\modules\language\widgets\LanguageForm; | |
| 4 | - use common\modules\product\models\Category; | |
| 5 | - use common\modules\product\models\CategoryLang; | |
| 3 | + use artweb\artbox\components\artboximage\ArtboxImageHelper; | |
| 4 | + use artweb\artbox\language\widgets\LanguageForm; | |
| 5 | + use artweb\artbox\ecommerce\models\Category; | |
| 6 | + use artweb\artbox\ecommerce\models\CategoryLang; | |
| 6 | 7 | use yii\helpers\Html; |
| 7 | 8 | use yii\web\View; |
| 8 | 9 | use yii\widgets\ActiveForm; |
| ... | ... | @@ -53,7 +54,7 @@ |
| 53 | 54 | 'gif', |
| 54 | 55 | 'png', |
| 55 | 56 | ], |
| 56 | - 'initialPreview' => !empty( $model->imageUrl ) ? \common\components\artboximage\ArtboxImageHelper::getImage( | |
| 57 | + 'initialPreview' => !empty( $model->imageUrl ) ? ArtboxImageHelper::getImage( | |
| 57 | 58 | $model->imageUrl, |
| 58 | 59 | 'list' |
| 59 | 60 | ) : '', |
| ... | ... | @@ -71,7 +72,7 @@ |
| 71 | 72 | <?= LanguageForm::widget( |
| 72 | 73 | [ |
| 73 | 74 | 'modelLangs' => $modelLangs, |
| 74 | - 'formView' => '@backend/views/category/_form_language', | |
| 75 | + 'formView' => '@artweb/artbox/ecommerce/views/category/_form_language', | |
| 75 | 76 | 'form' => $form, |
| 76 | 77 | ] |
| 77 | 78 | ) ?> | ... | ... |
views/category/_form_language.php
| 1 | 1 | <?php |
| 2 | - use common\modules\language\models\Language; | |
| 3 | - use common\modules\product\models\CategoryLang; | |
| 2 | + use artweb\artbox\language\models\Language; | |
| 3 | + use artweb\artbox\ecommerce\models\CategoryLang; | |
| 4 | 4 | use yii\web\View; |
| 5 | 5 | use yii\widgets\ActiveForm; |
| 6 | 6 | |
| ... | ... | @@ -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 ]); ?> | ... | ... |