Commit a96895442e2227093989f5bac09709848d133f4a
1 parent
886cf4d7
-Sort in categories
Showing
4 changed files
with
31 additions
and
2 deletions
Show diff stats
backend/views/category/_form.php
| ... | ... | @@ -69,6 +69,8 @@ use kartik\select2\Select2; |
| 69 | 69 | |
| 70 | 70 | <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> |
| 71 | 71 | |
| 72 | + <?= $form->field($model, 'sort') ?> | |
| 73 | + | |
| 72 | 74 | <?= $form->field($model, 'seo_text')->widget(CKEditor::className(), |
| 73 | 75 | [ |
| 74 | 76 | 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | ... | ... |
common/modules/product/models/Category.php
| ... | ... | @@ -18,6 +18,7 @@ use common\behaviors\Slug; |
| 18 | 18 | * @property integer $category_id |
| 19 | 19 | * @property string $remote_id |
| 20 | 20 | * @property integer $parent_id |
| 21 | + * @property integer $sort | |
| 21 | 22 | * @property string $path |
| 22 | 23 | * @property integer $depth |
| 23 | 24 | * @property string $image |
| ... | ... | @@ -76,7 +77,7 @@ class Category extends \yii\db\ActiveRecord |
| 76 | 77 | { |
| 77 | 78 | return [ |
| 78 | 79 | [['name'], 'string'], |
| 79 | - [['parent_id', 'depth', 'category_name_id', 'product_unit_id'], 'integer'], | |
| 80 | + [['parent_id', 'depth', 'category_name_id', 'product_unit_id', 'sort'], 'integer'], | |
| 80 | 81 | [['path', 'meta_desc', 'h1', 'seo_text'], 'string'], |
| 81 | 82 | [['meta_title', 'image', 'synonym'], 'string', 'max' => 255], |
| 82 | 83 | [['meta_robots'], 'string', 'max' => 50], |
| ... | ... | @@ -110,6 +111,7 @@ class Category extends \yii\db\ActiveRecord |
| 110 | 111 | 'name' => Yii::t('product', 'Name'), |
| 111 | 112 | 'remote_id' => Yii::t('product', 'Remote ID'), |
| 112 | 113 | 'synonym' => Yii::t('product', 'Синоним'), |
| 114 | + 'sort' => Yii::t('product', 'Порядок') | |
| 113 | 115 | ]; |
| 114 | 116 | } |
| 115 | 117 | ... | ... |
console/migrations/m170608_122754_add_sort_column_to_category_table.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | + use yii\db\Migration; | |
| 4 | + | |
| 5 | + /** | |
| 6 | + * Handles adding sort to table `category`. | |
| 7 | + */ | |
| 8 | + class m170608_122754_add_sort_column_to_category_table extends Migration | |
| 9 | + { | |
| 10 | + /** | |
| 11 | + * @inheritdoc | |
| 12 | + */ | |
| 13 | + public function up() | |
| 14 | + { | |
| 15 | + $this->addColumn('category', 'sort', $this->integer()); | |
| 16 | + } | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * @inheritdoc | |
| 20 | + */ | |
| 21 | + public function down() | |
| 22 | + { | |
| 23 | + $this->dropColumn('category', 'sort'); | |
| 24 | + } | |
| 25 | + } | ... | ... |
frontend/views/layouts/main-menu.php