Commit 6fb4a7325edf0505f56f0738159524db0e804550
1 parent
4556b430
Changes:
- Slider integration - Default product variants update
Showing
5 changed files
with
61 additions
and
48 deletions
Show diff stats
backend/views/category/_form.php
... | ... | @@ -104,6 +104,10 @@ use kartik\select2\Select2; |
104 | 104 | ) |
105 | 105 | ]) ?> |
106 | 106 | |
107 | + <?= $form->field($model, 'stock_program')->checkbox() ?> | |
108 | + | |
109 | + <?= $form->field($model, 'on_order')->checkbox() ?> | |
110 | + | |
107 | 111 | <div class="form-group"> |
108 | 112 | <?= Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
109 | 113 | <?php if ($model->isNewRecord) :?> | ... | ... |
common/modules/product/models/Category.php
... | ... | @@ -36,6 +36,8 @@ use yii\helpers\VarDumper; |
36 | 36 | * @property Product[] $products |
37 | 37 | * @property ProductUnit $productUnit |
38 | 38 | * @property ProductCategory[] $productCategories |
39 | + * @property boolean $stock_program | |
40 | + * @property boolean $on_order | |
39 | 41 | */ |
40 | 42 | class Category extends \yii\db\ActiveRecord |
41 | 43 | { |
... | ... | @@ -84,7 +86,7 @@ class Category extends \yii\db\ActiveRecord |
84 | 86 | [['imageUpload', 'brandImageUpload'], 'safe'], |
85 | 87 | [['imageUpload', 'brandImageUpload'], 'file', 'extensions' => 'jpg, gif, png'], |
86 | 88 | [['first_text', 'second_text'], 'string', 'max' => 255], |
87 | - [['new_collection'], 'boolean'], | |
89 | + [['new_collection', 'stock_program', 'on_order'], 'boolean'], | |
88 | 90 | ]; |
89 | 91 | } |
90 | 92 | |
... | ... | @@ -114,6 +116,8 @@ class Category extends \yii\db\ActiveRecord |
114 | 116 | 'second_text' => 'Подзаголовок', |
115 | 117 | 'new_collection' => 'Новая коллекция', |
116 | 118 | 'brand_image' => 'Картинка бренда', |
119 | + 'stock_program' => 'Складская программа', | |
120 | + 'on_order' => 'Под заказ', | |
117 | 121 | ]; |
118 | 122 | } |
119 | 123 | ... | ... |
console/migrations/m160928_151947_baccara_custom_category_columns.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160928_151947_baccara_custom_category_columns extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->addColumn('category', 'stock_program', $this->boolean()->defaultValue(false)); | |
10 | + $this->addColumn('category', 'on_order', $this->boolean()->defaultValue(false)); | |
11 | + | |
12 | + } | |
13 | + | |
14 | + public function down() | |
15 | + { | |
16 | + $this->dropColumn('category', 'stock_program'); | |
17 | + $this->dropColumn('category', 'on_order'); | |
18 | + } | |
19 | +} | ... | ... |
frontend/controllers/CatalogController.php
... | ... | @@ -152,6 +152,14 @@ class CatalogController extends \yii\web\Controller |
152 | 152 | 'pageSize' => 15, |
153 | 153 | ], |
154 | 154 | ]); |
155 | + $stockProgram = Category::find() | |
156 | + ->where([ | |
157 | + 'stock_program' => true, | |
158 | + ])->all(); | |
159 | + $onOrder = Category::find() | |
160 | + ->where([ | |
161 | + 'on_order' => true, | |
162 | + ])->all(); | |
155 | 163 | return $this->render('products', [ |
156 | 164 | 'category' => $category, |
157 | 165 | 'brandModel' => $brandModel, |
... | ... | @@ -163,6 +171,8 @@ class CatalogController extends \yii\web\Controller |
163 | 171 | 'productsProvider' => $dataProvider, |
164 | 172 | 'groups' => $groups, |
165 | 173 | 'priceLimits' => $priceLimits, |
174 | + 'stockProgram' => $stockProgram, | |
175 | + 'onOrder' => $onOrder, | |
166 | 176 | ]); |
167 | 177 | |
168 | 178 | } | ... | ... |
frontend/views/catalog/products.php
... | ... | @@ -5,9 +5,12 @@ |
5 | 5 | * @var View $this |
6 | 6 | * @var ActiveDataProvider $productsProvider |
7 | 7 | * @var Category $category |
8 | + * @var Category[] $stockProgram | |
9 | + * @var Category[] $onOrder | |
8 | 10 | */ |
9 | 11 | use common\modules\product\models\Category; |
10 | 12 | use yii\data\ActiveDataProvider; |
13 | +use yii\helpers\Url; | |
11 | 14 | use yii\web\View; |
12 | 15 | use yii\widgets\ListView; |
13 | 16 | use frontend\widgets\FilterWidget; |
... | ... | @@ -23,13 +26,16 @@ $this->params['breadcrumbs'][] = $this->title; |
23 | 26 | <a href="#" class="punkt">Складская программа</a> |
24 | 27 | <div class="spoiler"> |
25 | 28 | <ul> |
26 | - <li><a href="#">J&V <span>/ Италия</span></a></li> | |
27 | - <li><a href="#">Paravox <span>/ Германия</span></a></li> | |
28 | - <li><a href="#">Marburg <span>/ Германия</span></a></li> | |
29 | - <li><a href="#">Rasch Textile <span>/ Германия</span></a></li> | |
30 | - <li><a href="#">Sirpi <span>/ Италия</span></a></li> | |
31 | - <li><a href="#">AV Design Studio</a></li> | |
32 | - <li><a href="#">Deco Print <span>/ Бельгия</span></a></li> | |
29 | + <?php | |
30 | + foreach ($stockProgram as $brand) { | |
31 | + ?> | |
32 | + <li><a href="<?php | |
33 | + echo Url::to([ | |
34 | + 'category/brand', | |
35 | + 'id' => $brand->category_id, | |
36 | + ]); | |
37 | + ?>"><?php echo $brand->name;?> <span>/ <?php echo $brand->meta_desc;?></span></a></li> | |
38 | + <?php } ?> | |
33 | 39 | </ul> |
34 | 40 | </div> |
35 | 41 | </div> |
... | ... | @@ -37,46 +43,16 @@ $this->params['breadcrumbs'][] = $this->title; |
37 | 43 | <a href="#" class="punkt">Под заказ</a> |
38 | 44 | <div class="spoiler"> |
39 | 45 | <ul> |
40 | - <li><a href="#">Armani/Casa <span>/ Италия</span></a></li> | |
41 | - <li><a href="#">Jab Ansroetz <span>/ Германия</span></a></li> | |
42 | - <li><a href="#">Carlucci <span>/ Германия</span></a></li> | |
43 | - <li><a href="#">Chivasso <span>/ Германия</span></a></li> | |
44 | - <li><a href="#">Soleil Bleu <span>/ Германия</span></a></li> | |
45 | - <li><a href="#">Fuggerhaus <span>/ Германия</span></a></li> | |
46 | - <li><a href="#">Rasch <span>/ Германия</span></a></li> | |
47 | - <li><a href="#">Marburg <span>/ Германия</span></a></li> | |
48 | - <li><a href="#">Paravox <span>/ Германия</span></a></li> | |
49 | - <li><a href="#">BN <span>/ Италия</span></a></li> | |
50 | - <li><a href="#">Sirpi <span>/ Италия</span></a></li> | |
51 | - <li><a href="#">J&V <span>/ Бельгия</span></a></li> | |
52 | - <li><a href="#">Elitis <span>/ Франция</span></a></li> | |
53 | - <li><a href="#">Giardini <span>/ Италия</span></a></li> | |
54 | - <li><a href="#">Arlin <span>/ Италия</span></a></li> | |
55 | - <li><a href="#">Casamance <span>/ Франция</span></a></li> | |
56 | - <li><a href="#">Calcutta <span>/ Бельгия</span></a></li> | |
57 | - <li><a href="#">Sangiorgio <span>/ Италия</span></a></li> | |
58 | - <li><a href="#">Zuber and Cie <span>/ Франция</span></a></li> | |
59 | - <li><a href="#">Studio 465 <span>/ Америка</span></a></li> | |
60 | - <li><a href="#">Wallquest <span>/ США</span></a></li> | |
61 | - <li><a href="#">Eiiffinger <span>/ Голландия</span></a></li> | |
62 | - <li><a href="#">Arte <span>/ Бельгия</span></a></li> | |
63 | - <li><a href="#">Architects Paper <span>/ Германия</span></a></li> | |
64 | - <li><a href="#">AV Design Studio <span>/ Бельгия</span></a></li> | |
65 | - <li><a href="#">Cole & Son <span>/ Англия</span></a></li> | |
66 | - <li><a href="#">Coordonne <span>/ Испания</span></a></li> | |
67 | - <li><a href="#">Clarke & Clarke <span>/ Англия</span></a></li> | |
68 | - <li><a href="#">Designer Guilds <span>/ Англия</span></a></li> | |
69 | - <li><a href="#">Flocart <span>/ Бельгия</span></a></li> | |
70 | - <li><a href="#">Harlequin <span>/ Англия</span></a></li> | |
71 | - <li><a href="#">Hookedonwalls <span>/ Бельгия</span></a></li> | |
72 | - <li><a href="#">Hohenberger <span>/ Германия</span></a></li> | |
73 | - <li><a href="#">KollizArt <span>/ Германия</span></a></li> | |
74 | - <li><a href="#">Osborne & Little <span>/ Англия</span></a></li> | |
75 | - <li><a href="#">Omexco <span>/ Бельгия</span></a></li> | |
76 | - <li><a href="#">Print 4 <span>/ Италия</span></a></li> | |
77 | - <li><a href="#">Texam <span>/ Франция</span></a></li> | |
78 | - <li><a href="#">Thibaut <span>/ США</span></a></li> | |
79 | - <li><a href="#">Zambaiti Parati <span>/ Италия</span></a></li> | |
46 | + <?php | |
47 | + foreach ($onOrder as $brand) { | |
48 | + ?> | |
49 | + <li><a href="<?php | |
50 | + echo Url::to([ | |
51 | + 'category/brand', | |
52 | + 'id' => $brand->category_id, | |
53 | + ]); | |
54 | + ?>"><?php echo $brand->name;?> <span>/ <?php echo $brand->meta_desc;?></span></a></li> | |
55 | + <?php } ?> | |
80 | 56 | </ul> |
81 | 57 | </div> |
82 | 58 | </div> | ... | ... |