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 | 98 | { |
99 | 99 | $model = $this->findModel($id); |
100 | 100 | |
101 | + var_dump($_POST); | |
102 | + print "\n+++++++++++++++++++++++++++++++++++++\n"; | |
103 | + var_dump($_FILES); | |
104 | + exit; | |
105 | + | |
101 | 106 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
102 | 107 | return $this->redirect(['view', 'id' => $model->brand_id]); |
103 | 108 | } else { | ... | ... |
backend/views/brand/_form.php
... | ... | @@ -10,26 +10,15 @@ use yii\widgets\ActiveForm; |
10 | 10 | |
11 | 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 | 17 | <?= $form->field($model, 'name')->textInput() ?> |
16 | 18 | |
17 | 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 | 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 | 28 | 'bmp' => 'bmp', |
29 | 29 | ]; |
30 | 30 | |
31 | - public $uploadUrl = '/admin/artboxfile/action/upload'; | |
31 | + public $uploadUrl = '@web/artboxfile/action/upload'; | |
32 | 32 | |
33 | 33 | public function load($file = null, $driver = null) { |
34 | 34 | if(empty($file) || !realpath($file)) { |
... | ... | @@ -37,7 +37,8 @@ class ArtboxImage extends Component { |
37 | 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 | 42 | $options = [ |
42 | 43 | 'multiple' => $multiple, |
43 | 44 | ]; |
... | ... | @@ -54,7 +55,7 @@ class ArtboxImage extends Component { |
54 | 55 | 'overwriteInitial' => !$multiple, |
55 | 56 | 'showRemove' => true, |
56 | 57 | 'showUpload' => false, |
57 | - 'uploadUrl' => $this->uploadUrl, | |
58 | + 'uploadUrl' => $uploadUrl, | |
58 | 59 | 'uploadExtraData' => [ |
59 | 60 | 'fileField' => $modelField, |
60 | 61 | 'multiple' => intval($multiple), | ... | ... |
common/config/main.php
... | ... | @@ -130,8 +130,11 @@ return [ |
130 | 130 | ], |
131 | 131 | |
132 | 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 | 139 | 'relation' => [ |
137 | 140 | 'class' => 'common\modules\relation\Module', | ... | ... |
common/modules/product/models/Brand.php
... | ... | @@ -10,7 +10,7 @@ use Yii; |
10 | 10 | * This is the model class for table "brand". |
11 | 11 | * |
12 | 12 | * @property integer $brand_id |
13 | - * @property string $remote_id | |
13 | + | |
14 | 14 | * @property integer $brand_name_id |
15 | 15 | * @property string $alias |
16 | 16 | * @property string $image |
... | ... | @@ -67,7 +67,6 @@ class Brand extends \yii\db\ActiveRecord |
67 | 67 | [['alias', 'name'], 'string', 'max' => 250], |
68 | 68 | [['image', 'meta_title'], 'string', 'max' => 255], |
69 | 69 | [['meta_robots'], 'string', 'max' => 50], |
70 | - [['remote_id'], 'string', 'max' => 25], | |
71 | 70 | [['imageUpload'], 'safe'], |
72 | 71 | [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], |
73 | 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 | 89 | 'meta_desc' => Yii::t('product', 'Meta Desc'), |
91 | 90 | 'meta_robots' => Yii::t('product', 'Meta Robots'), |
92 | 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 | 5 | <li class="item"> |
6 | 6 | <div class="boxitem"> |
7 | 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 | 10 | </a> |
18 | 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 | 25 | <a href="<?= Url::to([ |
20 | 26 | 'catalog/product', |
21 | 27 | 'product' => $product]) |
... | ... | @@ -46,16 +52,11 @@ use yii\helpers\Url; |
46 | 52 | <div class="mycarousel"> |
47 | 53 | <ul class="jcarousel jcarousel-skin-tango"> |
48 | 54 | <?php foreach ($product->variants as $variant) : ?> |
49 | - <?php if (!empty($variant->image)) :?> | |
50 | 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 | 58 | </a> |
57 | 59 | </li> |
58 | - <?php endif; ?> | |
59 | 60 | <?php endforeach; ?> |
60 | 61 | </ul> |
61 | 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