Browse Source

商品分类

antshop
linyaostalker 5 years ago
parent
commit
2c62043bb0
  1. 4
      backend/modules/goods/models/ars/Category.php
  2. 2
      backend/modules/goods/views/category/_form.php

4
backend/modules/goods/models/ars/Category.php

@ -102,9 +102,9 @@ class Category extends \yii\db\ActiveRecord
* @return array * @return array
* 数据键值对 * 数据键值对
*/ */
public static function modelColumn($model)
public static function modelColumn()
{ {
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->andWhere(['!=', 'id', $model->id])->indexBy('id')->column();
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
} }
public function getIconFile() public function getIconFile()

2
backend/modules/goods/views/category/_form.php

@ -17,7 +17,7 @@ use backend\modules\goods\models\ars\Category;
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'pid')->dropDownList(array_merge([0 => '一级分类'], Category::modelColumn($model))) ?>
<?= $form->field($model, 'pid')->dropDownList(array_merge([0 => '一级分类'], Category::modelColumn())) ?>
<?= $form->field($model, 'sort_order')->textInput() ?> <?= $form->field($model, 'sort_order')->textInput() ?>

Loading…
Cancel
Save