Commit d89130bfea93750f4ae70d12ed505ebc2821f942
1 parent
43127bab
Main page sort
Showing
2 changed files
with
17 additions
and
7 deletions
Show diff stats
models/Category.php
@@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
19 | * @todo Write doc for ArtboxTreeBehavior | 19 | * @todo Write doc for ArtboxTreeBehavior |
20 | * @property integer $id | 20 | * @property integer $id |
21 | * @property integer $sort | 21 | * @property integer $sort |
22 | + * @property integer $sort2 | ||
22 | * @property integer $remote_id | 23 | * @property integer $remote_id |
23 | * @property integer $parent_id | 24 | * @property integer $parent_id |
24 | * @property string $path | 25 | * @property string $path |
@@ -68,7 +69,7 @@ | @@ -68,7 +69,7 @@ | ||
68 | return [ | 69 | return [ |
69 | 'artboxtree' => [ | 70 | 'artboxtree' => [ |
70 | 'class' => ArtboxTreeBehavior::className(), | 71 | 'class' => ArtboxTreeBehavior::className(), |
71 | - 'keyNameGroup' => NULL, | 72 | + 'keyNameGroup' => null, |
72 | 'keyNamePath' => 'path', | 73 | 'keyNamePath' => 'path', |
73 | ], | 74 | ], |
74 | 'language' => [ | 75 | 'language' => [ |
@@ -110,6 +111,7 @@ | @@ -110,6 +111,7 @@ | ||
110 | 'depth', | 111 | 'depth', |
111 | 'product_unit_id', | 112 | 'product_unit_id', |
112 | 'sort', | 113 | 'sort', |
114 | + 'sort2', | ||
113 | ], | 115 | ], |
114 | 'integer', | 116 | 'integer', |
115 | ], | 117 | ], |
@@ -138,6 +140,7 @@ | @@ -138,6 +140,7 @@ | ||
138 | 'product_unit_id' => Yii::t('product', 'Product Unit ID'), | 140 | 'product_unit_id' => Yii::t('product', 'Product Unit ID'), |
139 | 'remote_id' => Yii::t('product', 'Remote ID'), | 141 | 'remote_id' => Yii::t('product', 'Remote ID'), |
140 | 'sort' => Yii::t('product', 'Порядок вывода'), | 142 | 'sort' => Yii::t('product', 'Порядок вывода'), |
143 | + 'sort2' => Yii::t('product', 'Порядок вывода на главной'), | ||
141 | ]; | 144 | ]; |
142 | } | 145 | } |
143 | 146 | ||
@@ -212,7 +215,7 @@ | @@ -212,7 +215,7 @@ | ||
212 | { | 215 | { |
213 | if (parent::beforeSave($insert)) { | 216 | if (parent::beforeSave($insert)) { |
214 | 217 | ||
215 | - if (empty($this->parent_id)) { | 218 | + if (empty( $this->parent_id )) { |
216 | $this->parent_id = 0; | 219 | $this->parent_id = 0; |
217 | } | 220 | } |
218 | 221 |
views/category/_form.php
@@ -39,10 +39,14 @@ | @@ -39,10 +39,14 @@ | ||
39 | ) | 39 | ) |
40 | ->label(Yii::t('product', 'Parent category')) ?> | 40 | ->label(Yii::t('product', 'Parent category')) ?> |
41 | 41 | ||
42 | - <?php | ||
43 | - echo $form->field($model, 'sort'); | ||
44 | - ?> | ||
45 | - | 42 | + <?php |
43 | + echo $form->field($model, 'sort'); | ||
44 | + ?> | ||
45 | + | ||
46 | + <?php | ||
47 | + echo $form->field($model, 'sort2'); | ||
48 | + ?> | ||
49 | + | ||
46 | <?= $form->field($model, 'image') | 50 | <?= $form->field($model, 'image') |
47 | ->widget( | 51 | ->widget( |
48 | \kartik\file\FileInput::className(), | 52 | \kartik\file\FileInput::className(), |
@@ -85,7 +89,10 @@ | @@ -85,7 +89,10 @@ | ||
85 | 'gif', | 89 | 'gif', |
86 | 'png', | 90 | 'png', |
87 | ], | 91 | ], |
88 | - 'initialPreview' => !empty( $model->getImageUrl(1, false) ) ? ArtboxImageHelper::getImage( | 92 | + 'initialPreview' => !empty( $model->getImageUrl( |
93 | + 1, | ||
94 | + false | ||
95 | + ) ) ? ArtboxImageHelper::getImage( | ||
89 | $model->getImageUrl(1, false), | 96 | $model->getImageUrl(1, false), |
90 | 'list' | 97 | 'list' |
91 | ) : '', | 98 | ) : '', |