Commit 8e9033a5fd009429842eb068a8164e0849292074
1 parent
902cdc38
big commti
Showing
2 changed files
with
11 additions
and
5 deletions
Show diff stats
frontend/controllers/CatalogController.php
| @@ -152,9 +152,6 @@ class CatalogController extends \yii\web\Controller | @@ -152,9 +152,6 @@ class CatalogController extends \yii\web\Controller | ||
| 152 | /** @var Product $product */ | 152 | /** @var Product $product */ |
| 153 | $product = Yii::$app->request->get('product'); | 153 | $product = Yii::$app->request->get('product'); |
| 154 | 154 | ||
| 155 | - if(!$product->enabledVariant) { | ||
| 156 | - throw new HttpException(404, 'Товар не найден'); | ||
| 157 | - } | ||
| 158 | 155 | ||
| 159 | ProductHelper::addLastProsucts($product->product_id); | 156 | ProductHelper::addLastProsucts($product->product_id); |
| 160 | 157 |
frontend/views/catalog/product.php
| @@ -191,7 +191,11 @@ FlipclockAsset::register($this); | @@ -191,7 +191,11 @@ FlipclockAsset::register($this); | ||
| 191 | </tr> | 191 | </tr> |
| 192 | <tr> | 192 | <tr> |
| 193 | <td class="left_count available"> | 193 | <td class="left_count available"> |
| 194 | - под заказ | 194 | + <?php if($product->variant->stock > 0){?> |
| 195 | + есть в наличии | ||
| 196 | + <?php } else {?> | ||
| 197 | + нет в наличии | ||
| 198 | + <?php }?> | ||
| 195 | </td> | 199 | </td> |
| 196 | <td rowspan="2" class="spacer"> </td> | 200 | <td rowspan="2" class="spacer"> </td> |
| 197 | <td class="right_block" rowspan="2"> | 201 | <td class="right_block" rowspan="2"> |
| @@ -301,7 +305,12 @@ FlipclockAsset::register($this); | @@ -301,7 +305,12 @@ FlipclockAsset::register($this); | ||
| 301 | </div> | 305 | </div> |
| 302 | 306 | ||
| 303 | <div class="buy_button"> | 307 | <div class="buy_button"> |
| 304 | - <a href="#" class="btn btn-large buy_button" data-toggle="modal" data-id="<?php echo $product->variant->product_variant_id; ?>" data-target="#buyForm" lang="5892">Купить</a> | 308 | + <?php if($product->variant->stock > 0){?> |
| 309 | + <a href="#" class="btn btn-large buy_button" data-toggle="modal" data-id="<?php echo $product->variant->product_variant_id; ?>" data-target="#buyForm" lang="5892">Купить</a> | ||
| 310 | + <?php } else {?> | ||
| 311 | + <a href="#" class="btn btn-large btn-default buy_button" data-id="<?php echo $product->variant->product_variant_id; ?>" >Нет в наличии</a> | ||
| 312 | + <?php }?> | ||
| 313 | + | ||
| 305 | 314 | ||
| 306 | 315 | ||
| 307 | <div class="clearfix"></div> | 316 | <div class="clearfix"></div> |