I'm in Magento2,
All I need to do is get all the images of the products in the Wishlist Page.
This is my app/design/frontend/<Vendor>/<theme>/Magento_Wishlist/templates/item/list.phtml
<?php
/**
* Hyvä Themes - https://hyva.io
* Copyright © Hyvä Themes 2020-present. All rights reserved.
* This product is licensed per Magento install
* See https://hyva.io/license
*/
use Magento\Framework\Escaper;
use Magento\Wishlist\Block\Customer\Wishlist\Items;
/** @var Escaper $escaper */
/** @var Items $block */
$columns = $block->getColumns();
?>
<div class="products-grid wishlist">
<?php if (count($block->getItems())): ?>
<ol class="product-items flex flex-row flex-wrap">
<?php foreach ($block->getItems() as $item): ?>
<li data-row="product-item" class="product-item w-full sm:w-1/2 xl:w-1/3 flex"
id="item_<?= $escaper->escapeHtmlAttr($item->getId()) ?>">
<div class="product-item-info mr-2 mb-2 w-full" data-container="product-grid">
<?php foreach ($columns as $column): ?>
<?= $column->setItem($item)->toHtml();?>
<?php endforeach; ?>
</div>
</li>
<?php endforeach; ?>
</ol>
<?php else: ?>
<div class="message info empty">
<span><?= $escaper->escapeHtml(__('This Wish List has no Items')) ?></span>
</div>
<?php endif; ?>
</div>
<?php foreach ($columns as $column): ?>
<?= $column->getAdditionalHtml() ?>
<?php endforeach; ?>
This is my app/design/frontend/<Vendor>/<theme>/Magento_Wishlist/templates/item/column/image.phtml
<?php
/**
* Hyvä Themes - https://hyva.io
* Copyright © Hyvä Themes 2020-present. All rights reserved.
* This product is licensed per Magento install
* See https://hyva.io/license
*/
use Magento\Framework\Escaper;
use Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Image;
use Magento\Wishlist\Model\Item;
/** @var Image $block */
/** @var Escaper $escaper */
/** @var Item $item */
$item = $block->getItem();
$product = $item->getProduct();
?>
<a class="product-item-photo w-full flex mb-2" tabindex="-1"
href="<?= $escaper->escapeUrl($block->getProductUrl($item)) ?>"
title="<?= $escaper->escapeHtmlAttr($product->getName()) ?>">
<?= $block->getImage($block->getProductForThumbnail($item), 'wishlist_thumbnail')->toHtml() ?>
</a>
If I'm not wrong, use Magento\Wishlist\Block\Customer\Wishlist\Items;
and the variable $items
allows me to get all the product in the Wishlist, but the media gallery is apparently missing.
There's a way I can get the complete gallery in the Wishlist Page?
Thanks guys!