Commit f57bf6b783461cff49f9001a3160e96a9d44901d
1 parent
7cdb0894
Some fixes
Showing
3 changed files
with
4 additions
and
4 deletions
Show diff stats
backend/controllers/CategoryController.php
@@ -81,8 +81,7 @@ class CategoryController extends Controller | @@ -81,8 +81,7 @@ class CategoryController extends Controller | ||
81 | { | 81 | { |
82 | $model = new Category(); | 82 | $model = new Category(); |
83 | 83 | ||
84 | - if ($model->load(Yii::$app->request->post())) { | ||
85 | - $model->save(); | 84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { |
86 | 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)); | 85 | 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)); |
87 | } else { | 86 | } else { |
88 | if (!empty(Yii::$app->request->queryParams['parent'])) { | 87 | if (!empty(Yii::$app->request->queryParams['parent'])) { |
common/modules/product/models/Brand.php
@@ -59,7 +59,7 @@ class Brand extends \yii\db\ActiveRecord | @@ -59,7 +59,7 @@ class Brand extends \yii\db\ActiveRecord | ||
59 | public function rules() | 59 | public function rules() |
60 | { | 60 | { |
61 | return [ | 61 | return [ |
62 | - [['name'], 'required'], | 62 | + [['name'], 'string'], |
63 | [['brand_name_id'], 'integer'], | 63 | [['brand_name_id'], 'integer'], |
64 | [['meta_desc', 'seo_text'], 'string'], | 64 | [['meta_desc', 'seo_text'], 'string'], |
65 | [['alias', 'name'], 'string', 'max' => 250], | 65 | [['alias', 'name'], 'string', 'max' => 250], |
@@ -75,6 +75,7 @@ class Brand extends \yii\db\ActiveRecord | @@ -75,6 +75,7 @@ class Brand extends \yii\db\ActiveRecord | ||
75 | public function attributeLabels() | 75 | public function attributeLabels() |
76 | { | 76 | { |
77 | return [ | 77 | return [ |
78 | + 'name' => Yii::t('product', 'Name of the brand'), | ||
78 | 'brand_id' => Yii::t('product', 'Brand ID'), | 79 | 'brand_id' => Yii::t('product', 'Brand ID'), |
79 | 'brand_name_id' => Yii::t('product', 'Brand Name ID'), | 80 | 'brand_name_id' => Yii::t('product', 'Brand Name ID'), |
80 | 'alias' => Yii::t('product', 'Alias'), | 81 | 'alias' => Yii::t('product', 'Alias'), |
common/modules/product/models/Category.php
@@ -79,7 +79,7 @@ class Category extends \yii\db\ActiveRecord | @@ -79,7 +79,7 @@ class Category extends \yii\db\ActiveRecord | ||
79 | public function rules() | 79 | public function rules() |
80 | { | 80 | { |
81 | return [ | 81 | return [ |
82 | - [['name'], 'required'], | 82 | + [['name'], 'string'], |
83 | [['parent_id', 'depth', 'category_name_id', 'product_unit_id'], 'integer'], | 83 | [['parent_id', 'depth', 'category_name_id', 'product_unit_id'], 'integer'], |
84 | [['path', 'meta_desc', 'seo_text'], 'string'], | 84 | [['path', 'meta_desc', 'seo_text'], 'string'], |
85 | [['meta_title'], 'string', 'max' => 255], | 85 | [['meta_title'], 'string', 'max' => 255], |