Commit f0b521d0949612d0c060cd0fbfa5312facad1f5e

Authored by Виталий
1 parent fecf1dd4

-

Showing 1 changed file with 19 additions and 6 deletions   Show diff stats
frontend/views/catalog/_product_item.php
... ... @@ -13,7 +13,20 @@ use yii\helpers\Url;
13 13 <?= Html::a( $model->name, Url::to(['catalog/product', 'product' => $model->alias]), ['class'=>'btn-product-details'] )?>
14 14 </div>
15 15 <div class="img">
16   - <a class="btn-product-details" href="<?= Url::to([
  16 + <a class="btn-product-details"
  17 +
  18 + <?php
  19 + foreach($model->events as $event){
  20 + if($event->banner){
  21 + echo \common\components\artboximage\ArtboxImageHelper::getImage($event->getImageUrl('banner'), 'banner_list',[
  22 + 'class' => 'banner-in-list'
  23 + ]);
  24 + }
  25 + }
  26 +
  27 + ?>
  28 +
  29 + href="<?= Url::to([
17 30 'catalog/product',
18 31 'product' => $model->alias
19 32 ]) ?>">
... ... @@ -27,7 +40,7 @@ use yii\helpers\Url;
27 40 }
28 41  
29 42 ?>
30   - <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->enabledVariants[ 0 ]->imageUrl, 'list', [
  43 + <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->variant->imageUrl, 'list', [
31 44 'alt' => $model->category->name . ' ' . $model->name,
32 45 'title' => $model->category->name . ' ' . $model->name,
33 46 'class' => 'selected'
... ... @@ -108,11 +121,11 @@ use yii\helpers\Url;
108 121  
109 122 // есть скидка
110 123 echo '<p class="cost">';
111   - if($model->enabledVariants[ 0 ]->price_old != 0 && $model->enabledVariants[ 0 ]->price_old != $model->enabledVariants[ 0 ]->price) {
112   - echo '<strike><span id=\'old_cost\' itemprop="price">' . $model->enabledVariants[0]->price_old . '</span> грн.</strike>&nbsp;';
113   - echo $model->enabledVariants[0]->price . ' <span>грн.</span></p>';
  124 + if($model->variant->price_old != 0 && $model->variant->price_old != $model->variant->price) {
  125 + echo '<strike><span id=\'old_cost\' itemprop="price">' . $model->variant->price_old . '</span> грн.</strike>&nbsp;';
  126 + echo $model->variant->price . ' <span>грн.</span></p>';
114 127 } else {
115   - echo '<span itemprop="price">'.$model->enabledVariants[0]->price . ' </span><span>грн.</span></p>';
  128 + echo '<span itemprop="price">'.$model->variant->price . ' </span><span>грн.</span></p>';
116 129 }
117 130 echo '<meta itemprop="priceCurrency" content = "UAH">';
118 131 echo '</div>';
... ...