diff --git a/backend/controllers/CategoryController.php b/backend/controllers/CategoryController.php index 6050f58..e124301 100644 --- a/backend/controllers/CategoryController.php +++ b/backend/controllers/CategoryController.php @@ -81,8 +81,7 @@ class CategoryController extends Controller { $model = new Category(); - if ($model->load(Yii::$app->request->post())) { - $model->save(); + if ($model->load(Yii::$app->request->post()) && $model->save()) { return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect(['view', 'id' => $model->category_id]) : $this->redirect(array_merge(['create'], Yii::$app->request->queryParams)); } else { if (!empty(Yii::$app->request->queryParams['parent'])) { diff --git a/common/modules/product/models/Brand.php b/common/modules/product/models/Brand.php index 7c6bf04..1e0c7f4 100644 --- a/common/modules/product/models/Brand.php +++ b/common/modules/product/models/Brand.php @@ -59,7 +59,7 @@ class Brand extends \yii\db\ActiveRecord public function rules() { return [ - [['name'], 'required'], + [['name'], 'string'], [['brand_name_id'], 'integer'], [['meta_desc', 'seo_text'], 'string'], [['alias', 'name'], 'string', 'max' => 250], @@ -75,6 +75,7 @@ class Brand extends \yii\db\ActiveRecord public function attributeLabels() { return [ + 'name' => Yii::t('product', 'Name of the brand'), 'brand_id' => Yii::t('product', 'Brand ID'), 'brand_name_id' => Yii::t('product', 'Brand Name ID'), 'alias' => Yii::t('product', 'Alias'), diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php index 8561331..e76dbe5 100644 --- a/common/modules/product/models/Category.php +++ b/common/modules/product/models/Category.php @@ -79,7 +79,7 @@ class Category extends \yii\db\ActiveRecord public function rules() { return [ - [['name'], 'required'], + [['name'], 'string'], [['parent_id', 'depth', 'category_name_id', 'product_unit_id'], 'integer'], [['path', 'meta_desc', 'seo_text'], 'string'], [['meta_title'], 'string', 'max' => 255], -- libgit2 0.21.4