L
L
lzy2018-12-04 20:42:01
Yii
lzy, 2018-12-04 20:42:01

How to display images from Costa Rica without the main one?

Hi all. I use the extension Costa rica on yii2. Everything works, everything displays, but there is a problem if the main photo is a gallery, when I add the main photo, it is displayed as the very first in the general product gallery. How to set a cycle so that it does not display the main photo in the general list?
In the IsMain database, only one picture has a value of 1.

<?php $gallery = $model->getImages()
foreach($gallery as $img_g){
Html::img($img_g->getUrl('200x200')
} ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-12-04
@lzy

Good evening.

<?php $gallery = $model->getImages()
foreach($gallery as $img_g){
   if($img_g->isMain == 0){ // тут используйте свои значения
      Html::img($img_g->getUrl('200x200')
   }
} ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question