Quantcast
Channel: Webkul Blog
Viewing all articles
Browse latest Browse all 5556

Magento Product Thumbnail in Catalog Related Tab

$
0
0

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 :)

Facebook Twitter Email Reddit Stumbleupon

Viewing all articles
Browse latest Browse all 5556

Latest Images

Trending Articles



Latest Images