Showing posts with label Get product details on success page magento. Show all posts
Showing posts with label Get product details on success page magento. Show all posts

Monday 13 October 2014

How to get product image on success page magento


How to get product image on success page magento

Here i will try to cover up all the product information/details at magento success page. Probabbly people get sucks to fetch product images on success image. Here i have given small code for you....

Goto : app/design/frontend/YOURTHEME/default/template/checkout/success.phtml
Write below code wherever you want in this file.

<?php
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$orderItems = $order->getAllItems();
foreach($orderItems as $item)
{
    $_product = Mage::getModel('catalog/product')->load($item->getProductId());
?>
<div class="p-lisitngline l">
        <div class="p-list-view l">
            <div class="view_radio_box l">
                <img width="65" height="88" alt="" src="<?php echo Mage::helper('catalog/image')->init($_product,'small_image')->keepFrame(false)->resize(65,88); ?>" />
            </div>
            <div class="p-details-box l">
                <div class="l"><?php echo substr($item->getName(),0,25); ?></div>
                <div class="c"></div>
                <div class="l">PRODUCT CODE   : <span style="margin-left:6px"><?php echo $item->getSku(); ?></span></div>
                <div class="c"></div>
                <div class="l">ITEM WEIGHT    : <span style="margin-left:17px"><?php echo number_format($item->getWeight(),2); ?> Kg</span></div>
                <div class="c"></div>
            </div>
        </div>
        <div class="t-list-view r">
            <div class="r"><?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol().number_format($item->getPrice()) ;?></div>
        </div>
    </div>
<?php } ?>