更新时间:2023-11-30 09:43:46
您需要从产品而不是购物车中获取图像URL.请尝试以下操作:
You need to get the image url from the product and not the cart item. Try the following:
<img src="<?php echo $_item->getProduct()->getThumbnailUrl() ?>" alt="<?php echo $_item->getName() ?>" />
或者,如果您要调整图像的大小或对其进行任何其他操作,请使用目录/图像帮助器.这是获取图像并调整其大小的示例:
Or if you are going to be resizing the image or doing anything else with it then use the catalog/image helper. Here is an example of getting the image and resizing it:
<img src="<?php echo $this->helper('catalog/image')->init($_item->getProduct(), 'thumbnail')->resize(50); ?>" alt="<?php echo $_item->getName() ?>" />