0

我想在 magento 的订单成功页面上获取产品图像,这是代码

<?php
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());

foreach ($order->getAllItems() as $item) {

  //Need image code here

}
?>

有人知道如何在单页成功页面上获取产品图片吗

谢谢

4

2 回答 2

0

检查带有缩略图的图像的代码和平

<?php
$model = Mage::getModel('sales/order') //getting product model

$_product = $model->load(Mage::getSingleton('checkout/session')->getLastRealOrderId()); //getting product object for particular product id

echo $_product->getImageUrl(); //product's image url
echo $_product->getSmallImageUrl(); //product's small image url
echo $_product->getThumbnailUrl(); //product's thumbnail image url  

?>
于 2013-03-11T05:43:46.113 回答
0
       $orderIcrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();

       $order = Mage::getModel('sales/order')->loadByIncrementId($orderIcrementId);
       $orderItems = $order->getAllItems();
       foreach($orderItems as $orderItem):
         $_product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
         $product_small_image_path = Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135);
         $product_thumbnail_path = Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(56);
       endforeach;
于 2013-03-11T05:51:17.573 回答