Back to Top

Magento Product Thumbnail in Catalog Related Tab

Updated 7 November 2012

Magento Product Thumbnail in Catalog Related Tab – Magento does not provide the feature of showing thumbnails in product related tab so here is the simple hack for this

Go To  this location /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab and open related.php  

and add this function under _addColumnFilterToCollection()

protected function _prepareCollection()
    {
        $collection = Mage::getModel('catalog/product_link')->useRelatedLinks()
            ->getProductCollection()
            ->setProduct($this->_getProduct())
            ->addAttributeToSelect('*')
			->addExpressionAttributeToSelect('thumbnail',
"CONCAT('<img src=http://www.example.com/media/catalog/product',{{thumbnail}},
' width=80px>')",'thumbnail');

        if ($this->isReadonly()) {
            $productIds = $this->_getSelectedProducts();
            if (empty($productIds)) {
                $productIds = array(0);
            }
            $collection->addFieldToFilter('entity_id', array('in' => $productIds));
        }

        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

Here www.example.com is your domain name for the store . enjoy 🙂

Searching for an experienced
Magento Company ?
Find out More
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home