Commit 4b0990fd05ff48889d1f9e52cf4c58492aa00679
1 parent
57bb05b8
Image fixes
Showing
7 changed files
with
318 additions
and
311 deletions
Show diff stats
frontend/controllers/CategoryController.php
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | $query = $filterHelper->buildQuery() | 41 | $query = $filterHelper->buildQuery() |
42 | ->innerJoinWith('category', false) | 42 | ->innerJoinWith('category', false) |
43 | ->andWhere([ 'product_to_category.category_id' => $model->id ]) | 43 | ->andWhere([ 'product_to_category.category_id' => $model->id ]) |
44 | - ->with('images', 'variants', 'lang'); | 44 | + ->with('image', 'variants', 'lang'); |
45 | $dataProvider = new ActiveDataProvider( | 45 | $dataProvider = new ActiveDataProvider( |
46 | [ | 46 | [ |
47 | 'query' => $query, | 47 | 'query' => $query, |
frontend/controllers/ProductController.php
@@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
63 | * @var Product $model | 63 | * @var Product $model |
64 | */ | 64 | */ |
65 | $model = Product::findWithFilters() | 65 | $model = Product::findWithFilters() |
66 | - ->with('lang', 'images') | 66 | + ->with('lang', 'images', 'image') |
67 | ->with( | 67 | ->with( |
68 | [ | 68 | [ |
69 | 'category' => function ($query) { | 69 | 'category' => function ($query) { |
frontend/controllers/SiteController.php
@@ -56,17 +56,17 @@ | @@ -56,17 +56,17 @@ | ||
56 | ->where([ 'level' => 0 ]) | 56 | ->where([ 'level' => 0 ]) |
57 | ->all(); | 57 | ->all(); |
58 | $topItems = Product::find() | 58 | $topItems = Product::find() |
59 | - ->with('lang', 'images', 'variants') | 59 | + ->with('lang', 'image', 'variants') |
60 | ->where('mask & 1 != 0') | 60 | ->where('mask & 1 != 0') |
61 | ->limit(20) | 61 | ->limit(20) |
62 | ->all(); | 62 | ->all(); |
63 | $newItems = Product::find() | 63 | $newItems = Product::find() |
64 | - ->with('lang', 'images', 'variants') | 64 | + ->with('lang', 'image', 'variants') |
65 | ->where('mask & 2 != 0') | 65 | ->where('mask & 2 != 0') |
66 | ->limit(20) | 66 | ->limit(20) |
67 | ->all(); | 67 | ->all(); |
68 | $saleItems = Product::find() | 68 | $saleItems = Product::find() |
69 | - ->with('lang', 'images', 'variants') | 69 | + ->with('lang', 'image', 'variants') |
70 | ->where('mask & 4 != 0') | 70 | ->where('mask & 4 != 0') |
71 | ->limit(20) | 71 | ->limit(20) |
72 | ->all(); | 72 | ->all(); |
frontend/views/category/_product_item.php
1 | <?php | 1 | <?php |
2 | use artbox\catalog\models\Product; | 2 | use artbox\catalog\models\Product; |
3 | + use artbox\core\helpers\ImageHelper; | ||
3 | use yii\helpers\Html; | 4 | use yii\helpers\Html; |
4 | use yii\web\View; | 5 | use yii\web\View; |
5 | 6 | ||
@@ -12,14 +13,13 @@ | @@ -12,14 +13,13 @@ | ||
12 | <div class="product"> | 13 | <div class="product"> |
13 | <div class="image"> | 14 | <div class="image"> |
14 | <?php | 15 | <?php |
15 | - if (!empty( $product->images )) { | ||
16 | - $image = $product->images[ 0 ]; | ||
17 | - } else { | ||
18 | - $image = null; | ||
19 | - } | ||
20 | echo Html::a( | 16 | echo Html::a( |
21 | Html::img( | 17 | Html::img( |
22 | - $image ? $image->getUrl() : '/img/no-image.png', | 18 | + ImageHelper::set( |
19 | + $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png' | ||
20 | + ) | ||
21 | + ->fillResize(260, 260) | ||
22 | + ->render(), | ||
23 | [ | 23 | [ |
24 | 'class' => 'img-responsive-image1', | 24 | 'class' => 'img-responsive-image1', |
25 | ] | 25 | ] |
frontend/views/category/view.php
@@ -23,320 +23,327 @@ | @@ -23,320 +23,327 @@ | ||
23 | $this->params[ 'breadcrumbs' ][] = $seo->title; | 23 | $this->params[ 'breadcrumbs' ][] = $seo->title; |
24 | ?> | 24 | ?> |
25 | <div id="content"> | 25 | <div id="content"> |
26 | - <div class="container"> | 26 | + <div class="container"> |
27 | + | ||
28 | + <div class="row"> | ||
29 | + | ||
30 | + | ||
31 | + <!-- *** LEFT COLUMN *** | ||
32 | +_________________________________________________________ --> | ||
33 | + | ||
34 | + <div class="col-sm-3"> | ||
27 | 35 | ||
28 | - <div class="row"> | ||
29 | - | ||
30 | - | ||
31 | - <!-- *** LEFT COLUMN *** | ||
32 | - _________________________________________________________ --> | ||
33 | - | ||
34 | - <div class="col-sm-3"> | ||
35 | - | ||
36 | - <!-- *** MENUS AND FILTERS *** | 36 | + <!-- *** MENUS AND FILTERS *** |
37 | _________________________________________________________ --> | 37 | _________________________________________________________ --> |
38 | - | ||
39 | - <div class="panel panel-default sidebar-menu"> | ||
40 | - <?php | ||
41 | - if (!empty( $model->parent_id ) || !empty( $model->categories )) { | ||
42 | - ?> | ||
43 | - <div class="panel-body"> | ||
44 | - <ul class="nav nav-pills nav-stacked category-menu"> | ||
45 | - <li> | ||
46 | - <?php | ||
47 | - if (!empty( $model->parent_id )) { | ||
48 | - echo Html::a( | ||
49 | - $model->parent->lang->title, | ||
50 | - [ | ||
51 | - 'view', | ||
52 | - 'id' => $model->parent_id, | ||
53 | - ] | ||
54 | - ); | ||
55 | - } else { | ||
56 | - echo Html::a($model->lang->title, '#'); | ||
57 | - } | ||
58 | - ?> | ||
59 | - <ul> | ||
60 | - <?php | ||
61 | - if (!empty( $model->parent_id )) { | ||
62 | - foreach ($model->parent->categories as $childCategory) { | ||
63 | - echo Html::tag( | ||
64 | - 'li', | ||
65 | - Html::a( | ||
66 | - $childCategory->lang->title, | ||
67 | - ( $childCategory->id === $model->id ) ? '#' : [ | ||
68 | - 'view', | ||
69 | - 'id' => $childCategory->id, | ||
70 | - ] | ||
71 | - ), | ||
72 | - [ | ||
73 | - 'class' => ( $childCategory->id === $model->id ) ? 'active' : '', | ||
74 | - ] | ||
75 | - ); | ||
76 | - } | ||
77 | - } else { | ||
78 | - foreach ($model->categories as $childCategory) { | ||
79 | - echo Html::tag( | ||
80 | - 'li', | ||
81 | - Html::a( | ||
82 | - $childCategory->lang->title, | ||
83 | - [ | ||
84 | - 'view', | ||
85 | - 'id' => $childCategory->id, | ||
86 | - ] | ||
87 | - ) | ||
88 | - ); | ||
89 | - } | ||
90 | - } | ||
91 | - ?> | ||
92 | - </ul> | ||
93 | - </li> | ||
94 | - </ul> | ||
95 | - </div> | ||
96 | - <?php | ||
97 | - } | 38 | + |
39 | + <div class="panel panel-default sidebar-menu"> | ||
40 | + <?php | ||
41 | + if (!empty($model->parent_id) || !empty($model->categories)) { | ||
98 | ?> | 42 | ?> |
99 | - | ||
100 | - <div class="panel-heading"> | ||
101 | - <h3 class="panel-title"><?php echo \Yii::t('app', 'ะัะตะฝะดั'); ?></h3> | ||
102 | - </div> | ||
103 | - | ||
104 | - <div class="panel-body"> | ||
105 | - <div class="form-group"> | 43 | + <div class="panel-body"> |
44 | + <ul class="nav nav-pills nav-stacked category-menu"> | ||
45 | + <li> | ||
46 | + <?php | ||
47 | + if (!empty($model->parent_id)) { | ||
48 | + echo Html::a( | ||
49 | + $model->parent->lang->title, | ||
50 | + [ | ||
51 | + 'view', | ||
52 | + 'category' => $model->parent->lang->title, | ||
53 | + ] | ||
54 | + ); | ||
55 | + } else { | ||
56 | + echo Html::a($model->lang->title, '#'); | ||
57 | + } | ||
58 | + ?> | ||
59 | + <ul> | ||
106 | <?php | 60 | <?php |
107 | - foreach ($filterHelper->getBrands($model) as $brand) { | ||
108 | - /** | ||
109 | - * @var Product $product | ||
110 | - * @var Brand $brand | ||
111 | - */ | ||
112 | - echo Html::tag( | ||
113 | - 'div', | ||
114 | - Html::a( | ||
115 | - $brand->lang->title, | 61 | + if (!empty($model->parent_id)) { |
62 | + foreach ($model->parent->categories as $childCategory) { | ||
63 | + echo Html::tag( | ||
64 | + 'li', | ||
65 | + Html::a( | ||
66 | + $childCategory->lang->title, | ||
67 | + ( $childCategory->id === $model->id ) ? '#' : [ | ||
68 | + 'view', | ||
69 | + 'category' => $childCategory->lang->title, | ||
70 | + ] | ||
71 | + ), | ||
116 | [ | 72 | [ |
117 | - '/category/view', | ||
118 | - 'category' => $model->lang->alias->value, | ||
119 | - 'filter' => $filterHelper->buildLink($brand), | 73 | + 'class' => ( $childCategory->id === $model->id ) ? 'active' : '', |
120 | ] | 74 | ] |
121 | - ), | ||
122 | - [ | ||
123 | - 'class' => $filterHelper->has( | ||
124 | - $brand->lang->alias->value | ||
125 | - ) ? 'radio-but checked' : 'radio-but', | ||
126 | - ] | ||
127 | - ); | 75 | + ); |
76 | + } | ||
77 | + } else { | ||
78 | + foreach ($model->categories as $childCategory) { | ||
79 | + echo Html::tag( | ||
80 | + 'li', | ||
81 | + Html::a( | ||
82 | + $childCategory->lang->title, | ||
83 | + [ | ||
84 | + 'view', | ||
85 | + 'category' => $childCategory->lang->title, | ||
86 | + ] | ||
87 | + ) | ||
88 | + ); | ||
89 | + } | ||
128 | } | 90 | } |
129 | ?> | 91 | ?> |
130 | - </div> | ||
131 | - </div> | ||
132 | - </div> | ||
133 | - | ||
134 | - <?php | ||
135 | - foreach ($model->productOptionGroupCompls as $group) { | 92 | + </ul> |
93 | + </li> | ||
94 | + </ul> | ||
95 | + </div> | ||
96 | + <?php | ||
97 | + } | ||
98 | + ?> | ||
99 | + | ||
100 | + <?php | ||
101 | + $brands = $filterHelper->getBrands($model); | ||
102 | + if (!empty($brands)) { | ||
103 | + ?> | ||
104 | + <div class="panel-heading"> | ||
105 | + <h3 class="panel-title"><?php echo \Yii::t('app', 'ะัะตะฝะดั'); ?></h3> | ||
106 | + </div> | ||
107 | + | ||
108 | + <div class="panel-body"> | ||
109 | + <div class="form-group"> | ||
110 | + <?php | ||
111 | + foreach ($brands as $brand) { | ||
112 | + /** | ||
113 | + * @var Product $product | ||
114 | + * @var Brand $brand | ||
115 | + */ | ||
116 | + echo Html::tag( | ||
117 | + 'div', | ||
118 | + Html::a( | ||
119 | + $brand->lang->title, | ||
120 | + [ | ||
121 | + '/category/view', | ||
122 | + 'category' => $model->lang->alias->value, | ||
123 | + 'filter' => $filterHelper->buildLink($brand), | ||
124 | + ] | ||
125 | + ), | ||
126 | + [ | ||
127 | + 'class' => $filterHelper->has( | ||
128 | + $brand->lang->alias->value | ||
129 | + ) ? 'radio-but checked' : 'radio-but', | ||
130 | + ] | ||
131 | + ); | ||
132 | + } | ||
136 | ?> | 133 | ?> |
137 | - <div class="panel panel-default sidebar-menu"> | ||
138 | - <div class="panel-heading"> | ||
139 | - <h3><?php echo $group->lang->title; ?></h3> | ||
140 | - </div> | ||
141 | - <div class="panel-body"> | ||
142 | - <div class="form-group"> | ||
143 | - <?php | ||
144 | - foreach ($group->options as $option) { | ||
145 | - /** | ||
146 | - * @var Product $product | ||
147 | - */ | ||
148 | - echo Html::tag( | ||
149 | - 'div', | ||
150 | - Html::a( | ||
151 | - $option->lang->value, | ||
152 | - [ | ||
153 | - '/category/view', | ||
154 | - 'category' => $model->lang->alias->value, | ||
155 | - 'filter' => $filterHelper->buildLink($option), | ||
156 | - ] | ||
157 | - ), | ||
158 | - [ | ||
159 | - 'class' => $filterHelper->has( | ||
160 | - $option->lang->alias->value | ||
161 | - ) ? 'radio-but checked' : 'radio-but', | ||
162 | - ] | ||
163 | - ); | ||
164 | - } | ||
165 | - ?> | ||
166 | - </div> | ||
167 | - </div> | ||
168 | - </div> | 134 | + </div> |
135 | + </div> | ||
136 | + <?php | ||
137 | + } | ||
138 | + ?> | ||
139 | + </div> | ||
140 | + | ||
141 | + <?php | ||
142 | + foreach ($model->productOptionGroupCompls as $group) { | ||
143 | + ?> | ||
144 | + <div class="panel panel-default sidebar-menu"> | ||
145 | + <div class="panel-heading"> | ||
146 | + <h3><?php echo $group->lang->title; ?></h3> | ||
147 | + </div> | ||
148 | + <div class="panel-body"> | ||
149 | + <div class="form-group"> | ||
169 | <?php | 150 | <?php |
170 | - } | ||
171 | - foreach ($model->productOptionGroupExcls as $group) { | 151 | + foreach ($group->options as $option) { |
152 | + /** | ||
153 | + * @var Product $product | ||
154 | + */ | ||
155 | + echo Html::tag( | ||
156 | + 'div', | ||
157 | + Html::a( | ||
158 | + $option->lang->value, | ||
159 | + [ | ||
160 | + '/category/view', | ||
161 | + 'category' => $model->lang->alias->value, | ||
162 | + 'filter' => $filterHelper->buildLink($option), | ||
163 | + ] | ||
164 | + ), | ||
165 | + [ | ||
166 | + 'class' => $filterHelper->has( | ||
167 | + $option->lang->alias->value | ||
168 | + ) ? 'radio-but checked' : 'radio-but', | ||
169 | + ] | ||
170 | + ); | ||
171 | + } | ||
172 | ?> | 172 | ?> |
173 | - <div class="panel panel-default sidebar-menu"> | ||
174 | - <div class="panel-heading"> | ||
175 | - <h3><?php echo $group->lang->title; ?></h3> | ||
176 | - </div> | ||
177 | - <div class="panel-body"> | ||
178 | - <div class="form-group"> | ||
179 | - <?php | ||
180 | - foreach ($group->options as $option) { | ||
181 | - /** | ||
182 | - * @var Product $product | ||
183 | - */ | ||
184 | - echo Html::tag( | ||
185 | - 'div', | ||
186 | - Html::a( | ||
187 | - $option->lang->value, | ||
188 | - [ | ||
189 | - '/category/view', | ||
190 | - 'category' => $model->lang->alias->value, | ||
191 | - 'filter' => $filterHelper->buildLink($option), | ||
192 | - ] | ||
193 | - ), | ||
194 | - [ | ||
195 | - 'class' => $filterHelper->has( | ||
196 | - $option->lang->alias->value | ||
197 | - ) ? 'radio-but checked' : 'radio-but', | ||
198 | - ] | ||
199 | - ); | ||
200 | - } | ||
201 | - ?> | ||
202 | - </div> | ||
203 | - </div> | ||
204 | - </div> | 173 | + </div> |
174 | + </div> | ||
175 | + </div> | ||
176 | + <?php | ||
177 | + } | ||
178 | + foreach ($model->productOptionGroupExcls as $group) { | ||
179 | + ?> | ||
180 | + <div class="panel panel-default sidebar-menu"> | ||
181 | + <div class="panel-heading"> | ||
182 | + <h3><?php echo $group->lang->title; ?></h3> | ||
183 | + </div> | ||
184 | + <div class="panel-body"> | ||
185 | + <div class="form-group"> | ||
205 | <?php | 186 | <?php |
206 | - } | ||
207 | - foreach ($model->variantOptionGroupCompls as $group) { | 187 | + foreach ($group->options as $option) { |
188 | + /** | ||
189 | + * @var Product $product | ||
190 | + */ | ||
191 | + echo Html::tag( | ||
192 | + 'div', | ||
193 | + Html::a( | ||
194 | + $option->lang->value, | ||
195 | + [ | ||
196 | + '/category/view', | ||
197 | + 'category' => $model->lang->alias->value, | ||
198 | + 'filter' => $filterHelper->buildLink($option), | ||
199 | + ] | ||
200 | + ), | ||
201 | + [ | ||
202 | + 'class' => $filterHelper->has( | ||
203 | + $option->lang->alias->value | ||
204 | + ) ? 'radio-but checked' : 'radio-but', | ||
205 | + ] | ||
206 | + ); | ||
207 | + } | ||
208 | ?> | 208 | ?> |
209 | - <div class="panel panel-default sidebar-menu"> | ||
210 | - <div class="panel-heading"> | ||
211 | - <h3><?php echo $group->lang->title; ?></h3> | ||
212 | - </div> | ||
213 | - <div class="panel-body"> | ||
214 | - <div class="form-group"> | ||
215 | - <?php | ||
216 | - foreach ($group->options as $option) { | ||
217 | - /** | ||
218 | - * @var Product $product | ||
219 | - */ | ||
220 | - echo Html::tag( | ||
221 | - 'div', | ||
222 | - Html::a( | ||
223 | - $option->lang->value, | ||
224 | - [ | ||
225 | - '/category/view', | ||
226 | - 'category' => $model->lang->alias->value, | ||
227 | - 'filter' => $filterHelper->buildLink($option), | ||
228 | - ] | ||
229 | - ), | ||
230 | - [ | ||
231 | - 'class' => $filterHelper->has( | ||
232 | - $option->lang->alias->value | ||
233 | - ) ? 'radio-but checked' : 'radio-but', | ||
234 | - ] | ||
235 | - ); | ||
236 | - } | ||
237 | - ?> | ||
238 | - </div> | ||
239 | - </div> | ||
240 | - </div> | 209 | + </div> |
210 | + </div> | ||
211 | + </div> | ||
212 | + <?php | ||
213 | + } | ||
214 | + foreach ($model->variantOptionGroupCompls as $group) { | ||
215 | + ?> | ||
216 | + <div class="panel panel-default sidebar-menu"> | ||
217 | + <div class="panel-heading"> | ||
218 | + <h3><?php echo $group->lang->title; ?></h3> | ||
219 | + </div> | ||
220 | + <div class="panel-body"> | ||
221 | + <div class="form-group"> | ||
241 | <?php | 222 | <?php |
242 | - } | ||
243 | - foreach ($model->variantOptionGroupExcls as $group) { | 223 | + foreach ($group->options as $option) { |
224 | + /** | ||
225 | + * @var Product $product | ||
226 | + */ | ||
227 | + echo Html::tag( | ||
228 | + 'div', | ||
229 | + Html::a( | ||
230 | + $option->lang->value, | ||
231 | + [ | ||
232 | + '/category/view', | ||
233 | + 'category' => $model->lang->alias->value, | ||
234 | + 'filter' => $filterHelper->buildLink($option), | ||
235 | + ] | ||
236 | + ), | ||
237 | + [ | ||
238 | + 'class' => $filterHelper->has( | ||
239 | + $option->lang->alias->value | ||
240 | + ) ? 'radio-but checked' : 'radio-but', | ||
241 | + ] | ||
242 | + ); | ||
243 | + } | ||
244 | ?> | 244 | ?> |
245 | - <div class="panel panel-default sidebar-menu"> | ||
246 | - <div class="panel-heading"> | ||
247 | - <h3><?php echo $group->lang->title; ?></h3> | ||
248 | - </div> | ||
249 | - <div class="panel-body"> | ||
250 | - <div class="form-group"> | ||
251 | - <?php | ||
252 | - foreach ($group->options as $option) { | ||
253 | - /** | ||
254 | - * @var Product $product | ||
255 | - */ | ||
256 | - echo Html::tag( | ||
257 | - 'div', | ||
258 | - Html::a( | ||
259 | - $option->lang->value, | ||
260 | - [ | ||
261 | - '/category/view', | ||
262 | - 'category' => $model->lang->alias->value, | ||
263 | - 'filter' => $filterHelper->buildLink($option), | ||
264 | - ] | ||
265 | - ), | ||
266 | - [ | ||
267 | - 'class' => $filterHelper->has( | ||
268 | - $option->lang->alias->value | ||
269 | - ) ? 'radio-but checked' : 'radio-but', | ||
270 | - ] | ||
271 | - ); | ||
272 | - } | ||
273 | - ?> | ||
274 | - </div> | ||
275 | - </div> | ||
276 | - </div> | 245 | + </div> |
246 | + </div> | ||
247 | + </div> | ||
248 | + <?php | ||
249 | + } | ||
250 | + foreach ($model->variantOptionGroupExcls as $group) { | ||
251 | + ?> | ||
252 | + <div class="panel panel-default sidebar-menu"> | ||
253 | + <div class="panel-heading"> | ||
254 | + <h3><?php echo $group->lang->title; ?></h3> | ||
255 | + </div> | ||
256 | + <div class="panel-body"> | ||
257 | + <div class="form-group"> | ||
277 | <?php | 258 | <?php |
278 | - } | ||
279 | - ?> | ||
280 | - | ||
281 | - <!-- *** MENUS AND FILTERS END *** --> | ||
282 | - | ||
283 | - <!-- /.banner --> | ||
284 | - | ||
285 | - </div> | ||
286 | - <!-- /.col-md-3 --> | ||
287 | - | ||
288 | - <!-- *** LEFT COLUMN END *** --> | ||
289 | - | ||
290 | - <!-- *** RIGHT COLUMN *** | ||
291 | - _________________________________________________________ --> | ||
292 | - | ||
293 | - <div class="col-sm-9"> | ||
294 | - | ||
295 | - <?php | ||
296 | - echo ListView::widget( | ||
297 | - [ | ||
298 | - 'options' => [ | ||
299 | - 'class' => 'row products', | ||
300 | - ], | ||
301 | - 'itemOptions' => [ | ||
302 | - 'tag' => false, | ||
303 | - ], | ||
304 | - 'layout' => '{items}', | ||
305 | - 'dataProvider' => $dataProvider, | ||
306 | - 'itemView' => function ($model) use ($view) { | 259 | + foreach ($group->options as $option) { |
307 | /** | 260 | /** |
308 | - * @var Product $model | 261 | + * @var Product $product |
309 | */ | 262 | */ |
310 | - return $view->render( | ||
311 | - '_product_item', | 263 | + echo Html::tag( |
264 | + 'div', | ||
265 | + Html::a( | ||
266 | + $option->lang->value, | ||
267 | + [ | ||
268 | + '/category/view', | ||
269 | + 'category' => $model->lang->alias->value, | ||
270 | + 'filter' => $filterHelper->buildLink($option), | ||
271 | + ] | ||
272 | + ), | ||
312 | [ | 273 | [ |
313 | - 'product' => $model, | 274 | + 'class' => $filterHelper->has( |
275 | + $option->lang->alias->value | ||
276 | + ) ? 'radio-but checked' : 'radio-but', | ||
314 | ] | 277 | ] |
315 | ); | 278 | ); |
316 | - }, | ||
317 | - ] | ||
318 | - ); | ||
319 | - echo Html::tag( | ||
320 | - 'div', | ||
321 | - LinkPager::widget( | ||
322 | - [ | ||
323 | - 'pagination' => $dataProvider->pagination, | ||
324 | - ] | ||
325 | - ), | ||
326 | - [ | ||
327 | - 'class' => 'pages', | ||
328 | - ] | ||
329 | - ); | ||
330 | - ?> | ||
331 | - | ||
332 | - </div> | ||
333 | - <!-- /.col-md-9 --> | ||
334 | - | ||
335 | - <!-- *** RIGHT COLUMN END *** --> | 279 | + } |
280 | + ?> | ||
281 | + </div> | ||
282 | + </div> | ||
283 | + </div> | ||
284 | + <?php | ||
285 | + } | ||
286 | + ?> | ||
336 | 287 | ||
337 | - </div> | 288 | + <!-- *** MENUS AND FILTERS END *** --> |
289 | + | ||
290 | + <!-- /.banner --> | ||
291 | + | ||
292 | + </div> | ||
293 | + <!-- /.col-md-3 --> | ||
294 | + | ||
295 | + <!-- *** LEFT COLUMN END *** --> | ||
296 | + | ||
297 | + <!-- *** RIGHT COLUMN *** | ||
298 | +_________________________________________________________ --> | ||
299 | + | ||
300 | + <div class="col-sm-9"> | ||
301 | + | ||
302 | + <?php | ||
303 | + echo ListView::widget( | ||
304 | + [ | ||
305 | + 'options' => [ | ||
306 | + 'class' => 'row products', | ||
307 | + ], | ||
308 | + 'itemOptions' => [ | ||
309 | + 'tag' => false, | ||
310 | + ], | ||
311 | + 'layout' => '{items}', | ||
312 | + 'dataProvider' => $dataProvider, | ||
313 | + 'itemView' => function ($model) use ($view) { | ||
314 | + /** | ||
315 | + * @var Product $model | ||
316 | + */ | ||
317 | + return $view->render( | ||
318 | + '_product_item', | ||
319 | + [ | ||
320 | + 'product' => $model, | ||
321 | + ] | ||
322 | + ); | ||
323 | + }, | ||
324 | + ] | ||
325 | + ); | ||
326 | + echo Html::tag( | ||
327 | + 'div', | ||
328 | + LinkPager::widget( | ||
329 | + [ | ||
330 | + 'pagination' => $dataProvider->pagination, | ||
331 | + ] | ||
332 | + ), | ||
333 | + [ | ||
334 | + 'class' => 'pages', | ||
335 | + ] | ||
336 | + ); | ||
337 | + ?> | ||
338 | + | ||
339 | + </div> | ||
340 | + <!-- /.col-md-9 --> | ||
341 | + | ||
342 | + <!-- *** RIGHT COLUMN END *** --> | ||
338 | 343 | ||
339 | </div> | 344 | </div> |
340 | - <!-- /.container --> | 345 | + |
346 | + </div> | ||
347 | + <!-- /.container --> | ||
341 | </div> | 348 | </div> |
342 | <!-- /#content --> | 349 | <!-- /#content --> |
frontend/views/product/view.php
@@ -36,6 +36,9 @@ | @@ -36,6 +36,9 @@ | ||
36 | ]; | 36 | ]; |
37 | } | 37 | } |
38 | $this->params[ 'breadcrumbs' ][] = $seo->title; | 38 | $this->params[ 'breadcrumbs' ][] = $seo->title; |
39 | + if (!empty($model->image)) { | ||
40 | + array_unshift($model->images, $model->image); | ||
41 | + } | ||
39 | ?> | 42 | ?> |
40 | <div id="content"> | 43 | <div id="content"> |
41 | <div class="container"> | 44 | <div class="container"> |
frontend/views/site/_slider_product.php
1 | <?php | 1 | <?php |
2 | use artbox\catalog\models\Product; | 2 | use artbox\catalog\models\Product; |
3 | - use noam148\imagemanager\components\ImageManagerGetPath; | 3 | + use artbox\core\helpers\ImageHelper; |
4 | use yii\helpers\Html; | 4 | use yii\helpers\Html; |
5 | use yii\web\View; | 5 | use yii\web\View; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * @var View $this | 8 | * @var View $this |
9 | * @var Product $product | 9 | * @var Product $product |
10 | - * @var ImageManagerGetPath $imageManager | ||
11 | */ | 10 | */ |
12 | - $imageManager = \Yii::$app->get('imagemanager'); | ||
13 | ?> | 11 | ?> |
14 | <div class="col-md-3 col-sm-6"> | 12 | <div class="col-md-3 col-sm-6"> |
15 | <div class="product"> | 13 | <div class="product"> |
16 | <div class="image"> | 14 | <div class="image"> |
17 | <?php | 15 | <?php |
18 | - if (!empty( $product->images )) { | ||
19 | - $image = $product->images[ 0 ]->id; | ||
20 | - } else { | ||
21 | - $image = null; | ||
22 | - } | ||
23 | echo Html::a( | 16 | echo Html::a( |
24 | Html::img( | 17 | Html::img( |
25 | - $image ? $imageManager->getImagePath($image) : '/img/no-image.png', | 18 | + ImageHelper::set( |
19 | + $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png' | ||
20 | + ) | ||
21 | + ->fillResize(260, 260) | ||
22 | + ->render(), | ||
26 | [ | 23 | [ |
27 | 'class' => 'img-responsive-image1', | 24 | 'class' => 'img-responsive-image1', |
28 | ] | 25 | ] |