Commit e261c53790fb184cdd5261d2826d300150df781a
1 parent
776dd7a1
500 images fix
Showing
4 changed files
with
38 additions
and
25 deletions
 
Show diff stats
frontend/controllers/CatalogController.php
| ... | ... | @@ -24,8 +24,8 @@ class CatalogController extends \yii\web\Controller | 
| 24 | 24 | |
| 25 | 25 | public function actionCategory() | 
| 26 | 26 | { | 
| 27 | - | |
| 28 | - | |
| 27 | + | |
| 28 | + | |
| 29 | 29 | /** @var Category $category */ | 
| 30 | 30 | $category = Yii::$app->request->get('category'); | 
| 31 | 31 | $filter = Yii::$app->request->get('filters', [ ]); | 
| ... | ... | @@ -151,7 +151,7 @@ class CatalogController extends \yii\web\Controller | 
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | $priceLimits = $productModel->priceLimits($category, $params); | 
| 154 | - | |
| 154 | + | |
| 155 | 155 | |
| 156 | 156 | return $this->render('products', [ | 
| 157 | 157 | 'category' => $category, | ... | ... | 
frontend/views/catalog/_product_item.php
| ... | ... | @@ -38,12 +38,23 @@ use yii\helpers\Url; | 
| 38 | 38 | ?> | 
| 39 | 39 | |
| 40 | 40 | </div> | 
| 41 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list', [ | |
| 42 | - 'alt' => $model->getFullName(), | |
| 43 | - 'title' => $model->getFullName(), | |
| 44 | - 'class' => 'selected', | |
| 45 | - 'itemprop' => 'image' | |
| 46 | - ]) ?> | |
| 41 | + <?php | |
| 42 | + try { | |
| 43 | + echo \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list', [ | |
| 44 | + 'alt' => $model->getFullName(), | |
| 45 | + 'title' => $model->getFullName(), | |
| 46 | + 'class' => 'selected', | |
| 47 | + 'itemprop' => 'image' | |
| 48 | + ]); | |
| 49 | + } catch(Exception $exception) { | |
| 50 | + echo \common\components\artboximage\ArtboxImageHelper::getImage('/storage/no_photo.png', 'list', [ | |
| 51 | + 'alt' => $model->getFullName(), | |
| 52 | + 'title' => $model->getFullName(), | |
| 53 | + 'class' => 'selected', | |
| 54 | + 'itemprop' => 'image' | |
| 55 | + ]); | |
| 56 | + } | |
| 57 | + ?> | |
| 47 | 58 | </a> | 
| 48 | 59 | <div class="info_icons"> | 
| 49 | 60 | <?php if($model->variant->status != 1){?> | ... | ... | 
frontend/views/catalog/product.php
| ... | ... | @@ -44,8 +44,8 @@ | 
| 44 | 44 | $this->params['remarketing']['type'] = 'offerdetail'; | 
| 45 | 45 | $this->params['remarketing']['id'] = $product->variant->product_variant_id; | 
| 46 | 46 | $this->params['remarketing']['price'] = $product->getPrice(); | 
| 47 | + | |
| 47 | 48 | ?> | 
| 48 | - | |
| 49 | 49 | <div class="wrapper white item_container"> | 
| 50 | 50 | <div class="container"> | 
| 51 | 51 | <div class="product_detail" itemscope itemtype="http://schema.org/Product"> | 
| ... | ... | @@ -60,7 +60,6 @@ | 
| 60 | 60 | <div class="product_code">ะะพะด:<?= $product->variant->sku ?></div> | 
| 61 | 61 | <div class="clearfix"></div> | 
| 62 | 62 | <!-- Image part --> | 
| 63 | - | |
| 64 | 63 | <div class="img_part"> | 
| 65 | 64 | |
| 66 | 65 | <div class="position"> | 
| ... | ... | @@ -69,7 +68,6 @@ | 
| 69 | 68 | <div class="fotorama" data-allowfullscreen="true" data-nav="thumbs" | 
| 70 | 69 | data-width="342" | 
| 71 | 70 | data-height="350"> | 
| 72 | - | |
| 73 | 71 | <?php foreach($product->images as $image) : ?> | 
| 74 | 72 | <a href="<?= $image->imageUrl ?>"> | 
| 75 | 73 | <?= ArtboxImageHelper::getImage($image->imageUrl, 'product_show') ?> | 
| ... | ... | @@ -78,11 +76,21 @@ | 
| 78 | 76 | </div> | 
| 79 | 77 | <?php else : ?> | 
| 80 | 78 | <a href="<?= $product->imageUrl ?>" data-lightbox="image-1" data-title="<?= $product->fullname;?>"> | 
| 81 | - <?= ArtboxImageHelper::getImage($product->imageUrl, 'product_show',[ | |
| 82 | - 'alt'=>$product->fullname, | |
| 83 | - 'title' => $product->fullname, | |
| 84 | - 'itemprop' => 'image' | |
| 85 | - ]) ?> | |
| 79 | + <?php | |
| 80 | + try { | |
| 81 | + echo ArtboxImageHelper::getImage($product->imageUrl, 'product_show',[ | |
| 82 | + 'alt'=>$product->fullname, | |
| 83 | + 'title' => $product->fullname, | |
| 84 | + 'itemprop' => 'image' | |
| 85 | + ]); | |
| 86 | + } catch(Exception $exception) { | |
| 87 | + echo ArtboxImageHelper::getImage('/storage/no_photo.png', 'product_show',[ | |
| 88 | + 'alt'=>$product->fullname, | |
| 89 | + 'title' => $product->fullname, | |
| 90 | + 'itemprop' => 'image' | |
| 91 | + ]); | |
| 92 | + } | |
| 93 | + ?> | |
| 86 | 94 | </a> | 
| 87 | 95 | |
| 88 | 96 | <?php endif ?> | ... | ... | 
frontend/views/catalog/products.php
| ... | ... | @@ -60,7 +60,6 @@ | 
| 60 | 60 | 'priceLimits' => $priceLimits, | 
| 61 | 61 | //'filterBrands' => $filterBrands | 
| 62 | 62 | ])?> | 
| 63 | - | |
| 64 | 63 | <div class="clearfix"></div> | 
| 65 | 64 | |
| 66 | 65 | |
| ... | ... | @@ -102,6 +101,7 @@ | 
| 102 | 101 | ]); | 
| 103 | 102 | ?> | 
| 104 | 103 | </div> | 
| 104 | + | |
| 105 | 105 | <div class="clearfix"></div> | 
| 106 | 106 | </div> | 
| 107 | 107 | |
| ... | ... | @@ -117,14 +117,12 @@ | 
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | <div class="catalog_product_list view_table"> | 
| 120 | - | |
| 121 | - | |
| 122 | 120 | <?= ListView::widget([ | 
| 123 | 121 | 'dataProvider' => $productProvider, | 
| 124 | 122 | 'itemView' => function ($model, $key, $index, $widget) use($category) { | 
| 125 | 123 | return $this->render('_product_item',[ | 
| 126 | 124 | 'model' => $model, | 
| 127 | - 'category' => $category | |
| 125 | + 'category' => $category, | |
| 128 | 126 | ]); | 
| 129 | 127 | }, | 
| 130 | 128 | 'layout' => "{items}<div class=\"clearfix\"></div>{pager}", | 
| ... | ... | @@ -132,9 +130,6 @@ | 
| 132 | 130 | |
| 133 | 131 | ?> | 
| 134 | 132 | |
| 135 | - | |
| 136 | - | |
| 137 | - | |
| 138 | 133 | <div class="clearfix"></div> | 
| 139 | 134 | </div> | 
| 140 | 135 | |
| ... | ... | @@ -142,4 +137,3 @@ | 
| 142 | 137 | </div> | 
| 143 | 138 | <?php Pjax::end()?> | 
| 144 | 139 | |
| 145 | - | ... | ... | 
