Good Morning Everyone in Nullpro
i have some issues and i need to help
this issue if i went to products and create new product the category get this issue
Error filtering template: Warning: Invalid argument supplied for foreach() in /home/user/public_html/app/design/frontend/Sm/themecore/Magento_Catalog/templates/product/image_with_borders.phtml on line 36
1 exception(s):
Exception #0 (Exception): Warning: Invalid argument supplied for foreach() in /home/user/public_html/app/design/frontend/Sm/themecore/Magento_Catalog/templates/product/image_with_borders.phtml on line 36
& if i review the path category i get this issue too
the page code
i have some issues and i need to help
this issue if i went to products and create new product the category get this issue
Error filtering template: Warning: Invalid argument supplied for foreach() in /home/user/public_html/app/design/frontend/Sm/themecore/Magento_Catalog/templates/product/image_with_borders.phtml on line 36
1 exception(s):
Exception #0 (Exception): Warning: Invalid argument supplied for foreach() in /home/user/public_html/app/design/frontend/Sm/themecore/Magento_Catalog/templates/product/image_with_borders.phtml on line 36
& if i review the path category i get this issue too
the page code
PHP:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/** @var $block \Magento\Catalog\Block\Product\Image */
/** @var $escaper \Magento\Framework\Escaper */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
/**
* Enable lazy loading for images with borders and if variable enable_lazy_loading_for_images_without_borders
* is enabled in view.xml. Otherwise small size images without borders may be distorted. So max-width is used for them
* to prevent stretching and lazy loading does not work.
*/
$borders = (bool)$b->getVar('product_image_white_borders', 'Magento_Catalog');
$enableLazyLoadingWithoutBorders = (bool)$b->getVar(
'enable_lazy_loading_for_images_without_borders',
'Magento_Catalog'
);
$width = (int)$b->getWidth();
$paddingBottom = $b->getRatio() * 100;
$_config = $this->helper('Sm\Themecore\Helper\Data');
$enableLadyLoading = $_config->getAdvanced('lazyload_group/enable_ladyloading');
$mediaSrc = $_config->getMediaUrl();
if ($enableLadyLoading) {
$imgClass = 'lazyload';
} else {
$imgClass = '';
}
?>
<span class="product-image-container product-image-container-<?= /* @noEscape */
$b->getProductId() ?>" style="width: <?php echo $width . "px"; ?>">
<span class="product-image-wrapper">
<img class="<?= $escaper->escapeHtmlAttr($b->getClass()) ?> <?php echo $imgClass; ?>"
<?php foreach ($b->getCustomAttributes() as $name => $value): ?>
<?= $escaper->escapeHtmlAttr($name) ?>="<?= $escaper->escapeHtmlAttr($value) ?>"
<?php endforeach; ?>
<?php if ($enableLadyLoading) { ?>
src="<?php echo $mediaSrc . 'lazyloading/blank.png'; ?>"
data-src="<?= $escaper->escapeUrl($b->getImageUrl()) ?>"
<?php } else { ?>
src="<?= $escaper->escapeUrl($b->getImageUrl()) ?>"
<?php } ?>
loading="lazy"
<?php if ($borders || $enableLazyLoadingWithoutBorders): ?>
width="<?= $escaper->escapeHtmlAttr($b->getWidth()) ?>"
height="<?= $escaper->escapeHtmlAttr($b->getHeight()) ?>"
<?php else: ?>
max-width="<?= $escaper->escapeHtmlAttr($b->getWidth()) ?>"
max-height="<?= $escaper->escapeHtmlAttr($b->getHeight()) ?>"
<?php endif; ?>
alt="<?= $escaper->escapeHtmlAttr($b->getLabel()) ?>"/></span>
</span>
<?php
$styles = <<<STYLE
/**
.product-image-container-{$b->getProductId()} {
width: {$width}px;
}
*/
.product-image-container-{$b->getProductId()} span.product-image-wrapper {
padding-bottom: {$paddingBottom}%;
}
STYLE;
//In case a script was using "style" attributes of these elements
$script = <<<SCRIPT
prodImageContainers = document.querySelectorAll(".product-image-container-{$b->getProductId()}");
/**
for (var i = 0; i < prodImageContainers.length; i++) {
prodImageContainers[i].style.width = "{$width}px";
}
*/
prodImageContainersWrappers = document.querySelectorAll(
".product-image-container-{$b->getProductId()} span.product-image-wrapper"
);
for (var i = 0; i < prodImageContainersWrappers.length; i++) {
prodImageContainersWrappers[i].style.paddingBottom = "{$paddingBottom}%";
}
SCRIPT;
?>
<?= /* @noEscape */
$secureRenderer->renderTag('style', [], $styles, false) ?>
<?= /* @noEscape */
$secureRenderer->renderTag('script', ['type' => 'text/javascript'], $script, false) ?>