From 71bd843eef31b26aacd35c8a827c3450807a9731 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 21 Oct 2016 11:04:58 +0300 Subject: [PATCH] -Some fixes --- common/modules/product/models/Product.php | 11 +++++++++++ frontend/views/catalog/_product_list.php | 3 ++- frontend/views/category/collection.php | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php index f3344c3..b6799b5 100755 --- a/common/modules/product/models/Product.php +++ b/common/modules/product/models/Product.php @@ -208,6 +208,17 @@ // return !empty( $image ) ? $image->imageUrl : '/images/no_photo.png'; } + public function getMainImageUrl() + { + $image = $this->getImage()->andWhere([ + 'product_variant_id' => NULL, + ])->one(); + if(!empty($image)) { + return $image->imageUrl; + } + return null; + } + /** * @return \yii\db\ActiveQuery */ diff --git a/frontend/views/catalog/_product_list.php b/frontend/views/catalog/_product_list.php index cf8010c..e3843d2 100755 --- a/frontend/views/catalog/_product_list.php +++ b/frontend/views/catalog/_product_list.php @@ -21,8 +21,9 @@ use yii\widgets\ListView; 'product' => $model->alias, 'variant' => $model->variant->sku, ])?>"> +
getImageUrl(), 'product_list_item', ['class' => 'picture']); +// echo ArtboxImageHelper::getLazyDiv($model->getImageUrl(), 'product_list_item', ['class' => 'picture']); ?>
name; ?>
variant->sku; ?>
diff --git a/frontend/views/category/collection.php b/frontend/views/category/collection.php index a71e727..3ff1d73 100755 --- a/frontend/views/category/collection.php +++ b/frontend/views/category/collection.php @@ -54,7 +54,7 @@ $this->params['breadcrumbs'][] = $this->title; 'variant' => $product->variant->sku, ]); ?>" alt="nabuco">
name; ?>
- getImageUrl(), 'collections_thumb');?> + getMainImageUrl(), 'collections_thumb');?> -- libgit2 0.21.4