P
P
Pavel Surname2019-01-15 02:46:41
opencart
Pavel Surname, 2019-01-15 02:46:41

How to display a product in a modal window in a loop?

Good time of the day. Only the data of the last product is transmitted. That is, in all modal windows, information of the same product. What could be the reason? Thanks in advance.
PS I tried to display not in a modal window, just on a page, everything works, it does not work in a modal.

<?php foreach($products as $product):?>
            <li>
                <a  class="icon-link"><img src="<?=$product['thumb']?>"></a>
                <!-- Модальное окно -->
                <div id="<?php echo $product['product_id'];?>" class=" card-product"><i class="far fa-times-circle close"></i>
                    <?=$product['name']?><br>
                    <?=$product['description']?><br>
                    <?=$product['price']?>
                    <button class="product-add_to_cart" onclick="cart.add('<?php echo $product['product_id']; ?>');">Добавить в корзину
                    </button>
                </div>
            </li>
            <?php endforeach; ?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question