0

On our customer account dashboard, we want to display the product image inside the order. We want to display the image before the product title.

What code do I need to add to the file

app/design/frontend/theme/template/sales/order/items/renderer/default.phtml
2

Something like

$item = $this->getItem();

$product = $item->getParentId() ? $item->getParent()->getProduct() : $item->getProduct();

echo Mage::helper('catalog/image')->init($product, 'thumbnail');
0

Following code is what i used

<?php
// Load the product object
if($_item->getProductType() == 'configurable') {
    $_product = $_item->getProduct();
} else {
    $_product = Mage::getModel('catalog/product')->load($_item->getId());
}

// If no valid product could be loaded, use the default placeholder image for the product
$imgUrl = '/skin/frontend/default/default/images/catalog/product/placeholder/small_image.jpg';

// If a valid product has been loaded, use that product's thumbnail

if($_product->getId() && $_product->hasThumbnail()) {
    $imgUrl = Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(80, 120);
} 
?>

while, we have to consider the layout of the table, particularly when you hope it can be responsive.

the colspan=4 take trouble to us, while, we can change it by local.xml by following:

    <sales_order_view translate="label">
    <!--
        remove colspan=4 
    -->
    <reference name="order_totals">
        <action method="setLabelProperties"><value>colspan="3" class="a-right"</value></action>
        <action method="setValueProperties"><value>colspan="3" class="last a-right"</value></action>
    </reference>

</sales_order_view>

reference: https://mobweb.ch/2014-08-12-magento-showing-product-images-on-the-order-overview-in-the-admin-panel/

https://stackoverflow.com/questions/4349592/make-all-store-images-the-base-small-and-thumbnail-images-in-magento

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.