Commit 428b003db2f7c88eafda742a69184dbfb516a59a
1 parent
fe81463c
--
Showing
24 changed files
with
36 additions
and
39 deletions
Show diff stats
backend/controllers/BrandController.php
@@ -98,6 +98,11 @@ class BrandController extends Controller | @@ -98,6 +98,11 @@ class BrandController extends Controller | ||
98 | { | 98 | { |
99 | $model = $this->findModel($id); | 99 | $model = $this->findModel($id); |
100 | 100 | ||
101 | + var_dump($_POST); | ||
102 | + print "\n+++++++++++++++++++++++++++++++++++++\n"; | ||
103 | + var_dump($_FILES); | ||
104 | + exit; | ||
105 | + | ||
101 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 106 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
102 | return $this->redirect(['view', 'id' => $model->brand_id]); | 107 | return $this->redirect(['view', 'id' => $model->brand_id]); |
103 | } else { | 108 | } else { |
backend/views/brand/_form.php
@@ -10,26 +10,15 @@ use yii\widgets\ActiveForm; | @@ -10,26 +10,15 @@ use yii\widgets\ActiveForm; | ||
10 | 10 | ||
11 | <div class="brand-form"> | 11 | <div class="brand-form"> |
12 | 12 | ||
13 | - <?php $form = ActiveForm::begin(); ?> | 13 | + <?php $form = ActiveForm::begin([ |
14 | + 'options' => ['enctype' => 'multipart/form-data'] | ||
15 | + ]); ?> | ||
14 | 16 | ||
15 | <?= $form->field($model, 'name')->textInput() ?> | 17 | <?= $form->field($model, 'name')->textInput() ?> |
16 | 18 | ||
17 | <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | 19 | <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> |
18 | 20 | ||
19 | - <?= \common\modules\file\widgets\ImageUploader::widget([ | ||
20 | - 'model'=> $model, | ||
21 | - 'field'=>'image', | ||
22 | - 'size' => [ | ||
23 | - [ | ||
24 | - 'width'=>102, | ||
25 | - 'height'=>57, | ||
26 | - ] | ||
27 | - ], | ||
28 | - 'multi'=>false, | ||
29 | - 'gallery' => $model->image, | ||
30 | - 'name' => 'Загрузить изображение' | ||
31 | - ]); | ||
32 | - ?> | 21 | + <?= \common\components\artboximage\ArtboxImageHelper::fileinputWidget($model, 'imageUrl');?> |
33 | 22 | ||
34 | <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | 23 | <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> |
35 | 24 |
common/components/artboximage/ArtboxImage.php
@@ -28,7 +28,7 @@ class ArtboxImage extends Component { | @@ -28,7 +28,7 @@ class ArtboxImage extends Component { | ||
28 | 'bmp' => 'bmp', | 28 | 'bmp' => 'bmp', |
29 | ]; | 29 | ]; |
30 | 30 | ||
31 | - public $uploadUrl = '/admin/artboxfile/action/upload'; | 31 | + public $uploadUrl = '@web/artboxfile/action/upload'; |
32 | 32 | ||
33 | public function load($file = null, $driver = null) { | 33 | public function load($file = null, $driver = null) { |
34 | if(empty($file) || !realpath($file)) { | 34 | if(empty($file) || !realpath($file)) { |
@@ -37,7 +37,8 @@ class ArtboxImage extends Component { | @@ -37,7 +37,8 @@ class ArtboxImage extends Component { | ||
37 | return Image::factory($file, $driver ? $driver : $this->driver); | 37 | return Image::factory($file, $driver ? $driver : $this->driver); |
38 | } | 38 | } |
39 | 39 | ||
40 | - public function fileinputWidget($model, $modelField, $formField = 'fileUpload', $multiple = false, $imageOnly = true) { | 40 | + public function fileinputWidget($model, $modelField = 'file', $formField = 'fileUpload', $multiple = false, $imageOnly = true) { |
41 | + $uploadUrl = Yii::getAlias($this->uploadUrl); | ||
41 | $options = [ | 42 | $options = [ |
42 | 'multiple' => $multiple, | 43 | 'multiple' => $multiple, |
43 | ]; | 44 | ]; |
@@ -54,7 +55,7 @@ class ArtboxImage extends Component { | @@ -54,7 +55,7 @@ class ArtboxImage extends Component { | ||
54 | 'overwriteInitial' => !$multiple, | 55 | 'overwriteInitial' => !$multiple, |
55 | 'showRemove' => true, | 56 | 'showRemove' => true, |
56 | 'showUpload' => false, | 57 | 'showUpload' => false, |
57 | - 'uploadUrl' => $this->uploadUrl, | 58 | + 'uploadUrl' => $uploadUrl, |
58 | 'uploadExtraData' => [ | 59 | 'uploadExtraData' => [ |
59 | 'fileField' => $modelField, | 60 | 'fileField' => $modelField, |
60 | 'multiple' => intval($multiple), | 61 | 'multiple' => intval($multiple), |
common/config/main.php
@@ -130,8 +130,11 @@ return [ | @@ -130,8 +130,11 @@ return [ | ||
130 | ], | 130 | ], |
131 | 131 | ||
132 | 'modules' => [ | 132 | 'modules' => [ |
133 | - 'file' => [ | ||
134 | - 'class' => 'common\modules\file\Module', | 133 | +// 'file' => [ |
134 | +// 'class' => 'common\modules\file\Module', | ||
135 | +// ], | ||
136 | + 'artboxfile' => [ | ||
137 | + 'class' => 'common\modules\artboxfile\Module', | ||
135 | ], | 138 | ], |
136 | 'relation' => [ | 139 | 'relation' => [ |
137 | 'class' => 'common\modules\relation\Module', | 140 | 'class' => 'common\modules\relation\Module', |
common/modules/product/models/Brand.php
@@ -10,7 +10,7 @@ use Yii; | @@ -10,7 +10,7 @@ use Yii; | ||
10 | * This is the model class for table "brand". | 10 | * This is the model class for table "brand". |
11 | * | 11 | * |
12 | * @property integer $brand_id | 12 | * @property integer $brand_id |
13 | - * @property string $remote_id | 13 | + |
14 | * @property integer $brand_name_id | 14 | * @property integer $brand_name_id |
15 | * @property string $alias | 15 | * @property string $alias |
16 | * @property string $image | 16 | * @property string $image |
@@ -67,7 +67,6 @@ class Brand extends \yii\db\ActiveRecord | @@ -67,7 +67,6 @@ class Brand extends \yii\db\ActiveRecord | ||
67 | [['alias', 'name'], 'string', 'max' => 250], | 67 | [['alias', 'name'], 'string', 'max' => 250], |
68 | [['image', 'meta_title'], 'string', 'max' => 255], | 68 | [['image', 'meta_title'], 'string', 'max' => 255], |
69 | [['meta_robots'], 'string', 'max' => 50], | 69 | [['meta_robots'], 'string', 'max' => 50], |
70 | - [['remote_id'], 'string', 'max' => 25], | ||
71 | [['imageUpload'], 'safe'], | 70 | [['imageUpload'], 'safe'], |
72 | [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], | 71 | [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], |
73 | // [['brand_name_id'], 'exist', 'skipOnError' => true, 'targetClass' => BrandName::className(), 'targetAttribute' => ['brand_name_id' => 'brand_name_id']], | 72 | // [['brand_name_id'], 'exist', 'skipOnError' => true, 'targetClass' => BrandName::className(), 'targetAttribute' => ['brand_name_id' => 'brand_name_id']], |
@@ -90,7 +89,6 @@ class Brand extends \yii\db\ActiveRecord | @@ -90,7 +89,6 @@ class Brand extends \yii\db\ActiveRecord | ||
90 | 'meta_desc' => Yii::t('product', 'Meta Desc'), | 89 | 'meta_desc' => Yii::t('product', 'Meta Desc'), |
91 | 'meta_robots' => Yii::t('product', 'Meta Robots'), | 90 | 'meta_robots' => Yii::t('product', 'Meta Robots'), |
92 | 'seo_text' => Yii::t('product', 'Seo Text'), | 91 | 'seo_text' => Yii::t('product', 'Seo Text'), |
93 | - 'remote_id' => Yii::t('product', '1C brand name'), | ||
94 | ]; | 92 | ]; |
95 | } | 93 | } |
96 | 94 |
frontend/views/catalog/product_item.php
@@ -5,17 +5,23 @@ use yii\helpers\Url; | @@ -5,17 +5,23 @@ use yii\helpers\Url; | ||
5 | <li class="item"> | 5 | <li class="item"> |
6 | <div class="boxitem"> | 6 | <div class="boxitem"> |
7 | <div class="pixbox"> | 7 | <div class="pixbox"> |
8 | - <a href="<?= Url::to([ | ||
9 | - 'catalog/product', | ||
10 | - 'product' => $product]) | ||
11 | - ?>"> | ||
12 | - <?php if (empty($product->image)) :?> | ||
13 | - <img src="/img/no_photo.png"> | ||
14 | - <?php else :?> | ||
15 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->image->imageUrl, 'list')?> | ||
16 | - <?php endif?> | 8 | + <a href="<?= Url::to(['catalog/product', 'product' => $product])?>"> |
9 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->imageUrl, 'list')?> | ||
17 | </a> | 10 | </a> |
18 | </div> | 11 | </div> |
12 | + <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?> | ||
13 | + <ul class="product-special"> | ||
14 | + <?php if(!empty($product->is_top)) :?> | ||
15 | + <li class="top">top </li> | ||
16 | + <?php endif?> | ||
17 | + <?php if(!empty($product->is_new)) :?> | ||
18 | + <li class="new">new </li> | ||
19 | + <?php endif?> | ||
20 | + <?php if(!empty($product->akciya)) :?> | ||
21 | + <li class="promo">promo </li> | ||
22 | + <?php endif?> | ||
23 | + </ul> | ||
24 | + <?php endif?> | ||
19 | <a href="<?= Url::to([ | 25 | <a href="<?= Url::to([ |
20 | 'catalog/product', | 26 | 'catalog/product', |
21 | 'product' => $product]) | 27 | 'product' => $product]) |
@@ -46,16 +52,11 @@ use yii\helpers\Url; | @@ -46,16 +52,11 @@ use yii\helpers\Url; | ||
46 | <div class="mycarousel"> | 52 | <div class="mycarousel"> |
47 | <ul class="jcarousel jcarousel-skin-tango"> | 53 | <ul class="jcarousel jcarousel-skin-tango"> |
48 | <?php foreach ($product->variants as $variant) : ?> | 54 | <?php foreach ($product->variants as $variant) : ?> |
49 | - <?php if (!empty($variant->image)) :?> | ||
50 | <li> | 55 | <li> |
51 | - <a href="<?= Url::to([ | ||
52 | - 'catalog/product', | ||
53 | - 'product' => $product, | ||
54 | - '#' => 'm' . $variant->product_variant_id]) ?>"> | ||
55 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->image->imageUrl, 'product_variant')?> | 56 | + <a href="<?= Url::to(['catalog/product', 'product' => $product, '#' => 'm' . $variant->product_variant_id]) ?>"> |
57 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?> | ||
56 | </a> | 58 | </a> |
57 | </li> | 59 | </li> |
58 | - <?php endif; ?> | ||
59 | <?php endforeach; ?> | 60 | <?php endforeach; ?> |
60 | </ul> | 61 | </ul> |
61 | </div> | 62 | </div> |
219 KB
101 KB
99.2 KB
100 KB
71.5 KB
111 KB
131 KB
154 KB
101 KB
103 KB
104 KB
139 KB
157 KB
87.4 KB
75.9 KB
101 KB
123 KB
108 KB