In category list.phtml, it use <?= $productImage->toHtml() ?> to echo the image whereas the image html is in image_with_borders.phtml

$productImageHover = $block->getImage($_product, 'category_page_grid_hover');
                    <?php // Product Image ?>
                    <a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
                       class="product photo product-item-photo"
                       tabindex="-1" onmouseover="alert(this.children.src)">
                        <?= $productImage->toHtml() ?>

I want to pass $productImageHover to image_with_borders.phtml, anyone know how to do that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.