Commit e4c51f17 by liumengfei

优化列表

parent 2b5ac30b
...@@ -96,7 +96,6 @@ $_helper = $block->getData('outputHelper'); ...@@ -96,7 +96,6 @@ $_helper = $block->getData('outputHelper');
data-container="product-<?= /* @noEscape */ $viewMode ?>"> data-container="product-<?= /* @noEscape */ $viewMode ?>">
<?php <?php
$productImage = $block->getImage($_product, $imageDisplayArea); $productImage = $block->getImage($_product, $imageDisplayArea);
$baseImageUrl = $productImage->getImageUrl(); $baseImageUrl = $productImage->getImageUrl();
$allImage = $_product->getMediaGalleryImages()->getItems(); $allImage = $_product->getMediaGalleryImages()->getItems();
$hoverImg = ''; $hoverImg = '';
...@@ -106,21 +105,15 @@ $_helper = $block->getData('outputHelper'); ...@@ -106,21 +105,15 @@ $_helper = $block->getData('outputHelper');
break; break;
} }
} }
if ($pos != null) { if ($pos != null) {
$position = 'left:' . $productImage->getWidth() . 'px;' $position = 'left:' . $productImage->getWidth() . 'px;' . 'top:' . $productImage->getHeight() . 'px;';
. 'top:' . $productImage->getHeight() . 'px;';
} }
?> ?>
<?php // Product Image ?> <?php // Product Image ?>
<a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>" <a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
class="product photo product-item-photo" class="product photo product-item-photo"
tabindex="-1"> tabindex="-1">
<?php <?= $productImage->toHtml() ?>
$productImageRaw = $imageHelper->init($_product, $imageDisplayArea)->setImageFile($productImage->getFile())->resize($productImage->getWidth(),$productImage->getHeight())->getUrl();
?>
<img class="product-image-photo" style="background-color: #F0F0F0;" src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" />
<?php if ($hoverImg): ?> <?php if ($hoverImg): ?>
<img class="hoverImg" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" src="<?= $hoverImg ?>" loading="lazy" /> <img class="hoverImg" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" src="<?= $hoverImg ?>" loading="lazy" />
<?php endif; ?> <?php endif; ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment