在 magento 主题的顶部栏上构建迷你车。需要在 minicart 中显示产品缩略图和名称。我在目录“checkout/cart”中创建了一个文件 top_cart.phtml。使用下面给出的代码。
<?php
$_cartQty = $this->getSummaryCount();
$session = Mage::getSingleton('checkout/session');
if ($_cartQty == 0) : ?>
<span class="titleBlock">Your shopping cart is empty.</span>
<?php else :
foreach($session->getQuote()->getAllItems() as $_item): ?>
<div>
<span><?php echo $_item->getThumbnailImage(); ?></span>
<span><?php echo $_item->getName(); ?></span>
</div>
<?php endforeach ?>
<?php endif;?>
?>
现在名称显示正确,但未显示缩略图。请指导。