Commit 428b003db2f7c88eafda742a69184dbfb516a59a

Authored by Karnovsky A
1 parent fe81463c

--

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&nbsp;</li>
  16 + <?php endif?>
  17 + <?php if(!empty($product->is_new)) :?>
  18 + <li class="new">new&nbsp;</li>
  19 + <?php endif?>
  20 + <?php if(!empty($product->akciya)) :?>
  21 + <li class="promo">promo&nbsp;</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>
... ...
frontend/web/images/products/1305887984-2604-2605.jpg 0 → 100644

219 KB

frontend/web/images/products/1348483804-512-2445.jpg 0 → 100644

101 KB

frontend/web/images/products/1348484212-3723-3585.jpg 0 → 100644

99.2 KB

frontend/web/images/products/1348484611-4020-7396.jpg 0 → 100644

100 KB

frontend/web/images/products/1348485104-4555-7650.jpg 0 → 100644

71.5 KB

frontend/web/images/products/1348487239-495-4299.jpg 0 → 100644

111 KB

frontend/web/images/products/1348487515-4424-1546.jpg 0 → 100644

131 KB

frontend/web/images/products/1348489125-7133-6866.jpg 0 → 100644

154 KB

frontend/web/images/products/1348489542-702-5816.jpg 0 → 100644

101 KB

frontend/web/images/products/1348490194-360-284.jpg 0 → 100644

103 KB

frontend/web/images/products/1348490344-6421-5352.jpg 0 → 100644

104 KB

frontend/web/images/products/1348490519-4780-1400.jpg 0 → 100644

139 KB

frontend/web/images/products/1348492885-9127-2291.jpg 0 → 100644

157 KB

frontend/web/images/products/1366971036-9093-9799.jpg 0 → 100644

87.4 KB

frontend/web/images/products/1366971215-512-3729.jpg 0 → 100644

75.9 KB

frontend/web/images/products/1366971885-6949-9056.jpg 0 → 100644

101 KB

frontend/web/images/products/1372148121-6202-6680.jpg 0 → 100644

123 KB

frontend/web/images/products/1372148169-4614-4290.jpg 0 → 100644

108 KB