congratulations to the community, I use it a lot to find solutions that are always useful, but this time I'm completely blocked.

After doing a setup: upgrade and a setup: di: compile following installation of Welt Pixels, all products in the categories are gone. I can see them in the Products section (in the backend) but in the Frontend they seem "invisible". In the categories it doesn't tell me that there are no products, they just aren't seen.

I've tried re-indexing, clearing cache, and all ordinary operations, but nothing to do.

I tried to see the log files (system.log) which gives me this error:

main.CRITICAL: Warning: Invalid argument supplied for foreach() in /var/www/html/magento/vendor/magento/module-catalog/view/frontend/templates/product/image_with_borders.phtml on line 27 [] []

In the phtml file mentioned in the logs I find this:

<span class="product-image-container product-image-container-<?= /* @noEscape */ $block->getProductId() ?>">
    <span class="product-image-wrapper">
        <img class="<?= $escaper->escapeHtmlAttr($block->getClass()) ?>"
            <?php foreach ($block->getCustomAttributes() as $name => $value): ?>
                <?= $escaper->escapeHtmlAttr($name) ?>="<?= $escaper->escapeHtmlAttr($value) ?>" 
            <?php endforeach; ?>
            src="<?= $escaper->escapeUrl($block->getImageUrl()) ?>"
            <?php if ($borders || $enableLazyLoadingWithoutBorders): ?>
                width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
                height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
            <?php else: ?>
                max-width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
                max-height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
            <?php endif; ?>
            alt="<?= $escaper->escapeHtmlAttr($block->getLabel()) ?>"/></span>

Specifically, line 27 reads:

<?php foreach ($block->getCustomAttributes() as $name => $value): ?>

I am hoping for your guidance, I can't figure out if it's an array problem or something.

  • have you used any custom extensions? – Rizwan Khan Sep 29 '20 at 13:22
  • Thanks for comment. I have one Extension enabled "LiteExtensione migration from Woocommerce", but i have put them few days ago (i have already done a setup:upgrade before, and i haven't had problem). Today i've try to install Welt Pixels free with composer for the slider, and the installation was good. But after setup:upgrade i've seen the error – Alberto Sep 29 '20 at 13:27
  • Try to disabled that Welt Pixels extension and then try. – Rizwan Khan Sep 30 '20 at 4:23
  • @Alberto i have same issue facing , which changes throgh you have fixed? – Rakesh Donga Feb 24 at 7:39

I have the same problem, so I removed the lines below and started to display the products. I don't know if this will affect other features.

<?php foreach ($block->getCustomAttributes() as $name => $value): ?> <?= $escaper->escapeHtmlAttr($name) ?>="<?= $escaper->escapeHtmlAttr($value) ?>" <?php endforeach; ?>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.