0
votes

i have magento 1.6.2.

Now i would like to show the thumbnails in the sales/order screen. After some googleing i have found some work arounds ...

I have added the next code to the app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml

    <?php $product = Mage::getModel('catalog/product')
->setStoreId($_item->getOrder()->getStoreId())
->load($_item->getProductId());
?>
<p align="center"><img src="<?php echo Mage::helper('catalog/image')->init($product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" /></p>

This works fine for simple products. For the simple products generated by the configurable products i get the placeholder "no image"

For the record: when i make a configurable product, my extension doesn't give the simple products a image. Only the base (parent) configurable product.

Now i need to call the image from the configurable product, in stead of the simpleproduct. Who can help me?

2

2 Answers

1
votes

All depends on if you want to display an image of slave (simple) product or master (configurable) product.

For first case the following code shall work:

<td>
    <?php $_product = Mage::getModel('catalog/product')->load($_item->getId()); ?>
    <img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />
</td>

For the second case use the following code:

<td>
    <?php

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

    ?>
    <img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />
</td>

In both cases pleas make sure you have an image uploaded and selected as a small image for your product. See screenshot below:

enter image description here

0
votes

http://www.magentocommerce.com/magento-connect/advanced-ordergrid-with-images.html Use this extension.This will show product thumbnail images along with a jQuery scroller. Also you can see the payment and shipping method using this extension. I have use it on Magento 1.7. It is working fine...