Commit 69bea8693ac65646add97529ad9e484cef04d974

Authored by Alexey Boroda
1 parent 5a29abd6

-Product fields added

common/modules/product/models/Product.php
... ... @@ -37,6 +37,8 @@
37 37 * @property TaxOption[] $options
38 38 * @property ProductVariant[] $variants
39 39 * @property string $alias
  40 + * @property string $size
  41 + * @property string $material
40 42 */
41 43 class Product extends \yii\db\ActiveRecord
42 44 {
... ... @@ -92,7 +94,11 @@
92 94 'max' => 150,
93 95 ],
94 96 [
95   - [ 'alias' ],
  97 + [
  98 + 'alias',
  99 + 'size',
  100 + 'material',
  101 + ],
96 102 'string',
97 103 'max' => 250,
98 104 ],
... ... @@ -138,12 +144,15 @@
138 144 // relation behavior field
139 145 'image' => Yii::t('product', 'Image'),
140 146 'images' => Yii::t('product', 'Images'),
141   - 'description' => Yii::t('product', 'Description'),
  147 + 'description' => 'Описание',
142 148 'video' => Yii::t('product', 'Video embeded'),
143 149 'variants' => Yii::t('product', 'Variants'),
144 150 'is_top' => Yii::t('product', 'Is top'),
145 151 'is_new' => Yii::t('product', 'Is new'),
146 152 'akciya' => Yii::t('product', 'Is promo'),
  153 + 'imagesUpload'=> 'Картинки',
  154 + 'size' => 'Размер',
  155 + 'material' => 'Состав',
147 156 ];
148 157 }
149 158  
... ...
common/modules/product/views/manage/_form.php
... ... @@ -25,7 +25,11 @@
25 25 <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
26 26  
27 27 <?= $form->field($model, 'akciya')->checkbox(['label' => 'Акционный']) ?>
28   -
  28 +
  29 + <?= $form->field($model, 'size')->textInput() ?>
  30 +
  31 + <?= $form->field($model, 'material')->textInput() ?>
  32 +
29 33 <?= $form->field($model, 'description')->widget(\mihaildev\ckeditor\CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ], ]); ?>
30 34  
31 35 <?= $form->field($model, 'categories')->widget(Select2::className(), [
... ...
console/migrations/m161007_134913_custom_baccara_fields.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m161007_134913_custom_baccara_fields extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->addColumn('product', 'size', $this->string(255));
  10 + $this->addColumn('product', 'material', $this->string(255));
  11 + }
  12 +
  13 + public function down()
  14 + {
  15 + $this->dropColumn('product', 'material');
  16 + $this->dropColumn('product', 'size');
  17 + }
  18 +}
... ...
frontend/views/catalog/view.php
... ... @@ -58,8 +58,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
58 58  
59 59 <ul>
60 60 <li><span>Артикул:</span> <?php echo $variant->sku; ?></li>
61   - <li><span>Размер:</span> 384 x 300 см</li>
62   - <li><span>Состав:</span> 100% шелк</li>
  61 + <li><span>Размер:</span> <?php echo $product->size; ?></li>
  62 + <li><span>Состав:</span> <?php echo $product->material; ?></li>
63 63 </ul>
64 64 </div>
65 65 <div style="clear:both;"></div>
... ...
frontend/views/product/view.php
... ... @@ -58,8 +58,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
58 58  
59 59 <ul>
60 60 <li><span>Артикул:</span> <?php echo $variant->sku; ?></li>
61   - <li><span>Размер:</span> 384 x 300 см</li>
62   - <li><span>Состав:</span> 100% шелк</li>
  61 + <li><span>Размер:</span> <?php echo $product->size; ?></li>
  62 + <li><span>Состав:</span> <?php echo $product->material; ?></li>
63 63 </ul>
64 64 </div>
65 65 <div style="clear:both;"></div>
... ...