diff --git a/backend/controllers/BrandController.php b/backend/controllers/BrandController.php index fd49a06..75b070b 100755 --- a/backend/controllers/BrandController.php +++ b/backend/controllers/BrandController.php @@ -98,8 +98,14 @@ class BrandController extends Controller { $model = $this->findModel($id); - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->brand_id]); + if ($model->load(Yii::$app->request->post())) { +// var_dump($_POST); +// print "
"; +// var_dump($_FILES); +// exit; + if ($model->save()) { + return $this->redirect(['view', 'id' => $model->brand_id]); + } } else { return $this->render('update', [ 'model' => $model, diff --git a/backend/views/brand/_form.php b/backend/views/brand/_form.php index 04c4f19..0f2e78a 100755 --- a/backend/views/brand/_form.php +++ b/backend/views/brand/_form.php @@ -11,6 +11,7 @@ use yii\widgets\ActiveForm;
false, 'options' => ['enctype' => 'multipart/form-data'] ]); ?> diff --git a/common/modules/product/models/Brand.php b/common/modules/product/models/Brand.php index f369a87..8f65f41 100755 --- a/common/modules/product/models/Brand.php +++ b/common/modules/product/models/Brand.php @@ -27,8 +27,6 @@ use Yii; */ class Brand extends \yii\db\ActiveRecord { - public $imageUpload; - public function behaviors() { return [ @@ -46,12 +44,12 @@ class Brand extends \yii\db\ActiveRecord 'translit' => true ], 'uploader' => [ - 'class' => UploadImageBehavior::className(), - 'attribute' => 'image', + 'class' => UploadBehavior::className(), + 'attribute' => 'fileUpload', 'scenarios' => ['insert', 'update'], // 'placeholder' => '@app/modules/user/assets/images/userpic.jpg', - 'path' => '@storage/{alias}', - 'url' => '/storage/{alias}', + 'path' => '@storage/brands/{alias}', + 'url' => '/storage/brands/{alias}', // 'thumbs' => [ // 'thumb' => ['width' => 400, 'quality' => 90], // 'preview' => ['width' => 200, 'height' => 200], @@ -79,10 +77,9 @@ class Brand extends \yii\db\ActiveRecord [['brand_name_id'], 'integer'], [['meta_desc', 'seo_text'], 'string'], [['alias', 'name'], 'string', 'max' => 250], - [['image', 'meta_title'], 'string', 'max' => 255], + [['meta_title'], 'string', 'max' => 255], [['meta_robots'], 'string', 'max' => 50], - [['imageUpload'], 'safe'], - [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], + [['fileUpload'], 'file', 'extensions' => 'jpg, gif, png'], // [['brand_name_id'], 'exist', 'skipOnError' => true, 'targetClass' => BrandName::className(), 'targetAttribute' => ['brand_name_id' => 'brand_name_id']], ]; } diff --git a/common/modules/product/widgets/views/products_block.php b/common/modules/product/widgets/views/products_block.php index 4f0d380..962ee15 100644 --- a/common/modules/product/widgets/views/products_block.php +++ b/common/modules/product/widgets/views/products_block.php @@ -1,4 +1,4 @@ -
+

    -- libgit2 0.21.4