Magento How to get base image in upsell product on product view page





Hi Friend's

I would like to show the base image in upsell product, not the thumbnail or the small image but the image.

So i have add addAttributeToSelect in upsell product collection file

First copy Upsell.php file
Path : app/code/core/Mage/Catalog/Block/Product/List/
And paste following path
Path : app/code/local/Mage/Catalog/Block/Product/List/

Now open Upsell.php file
And find this function " protected function _prepareData() "
And add this line
" $this->_itemCollection->addAttributeToSelect('image'); "
before
" $this->_itemCollection->load(); "

Now Open upsell.phtml
Path : app/design/frontend/Your package/Your theme/template/catalog/product/list
And fine " $this->helper('catalog/image')->init($_link, 'small_image')->resize(125) "
And replace this line
" $this->helper('catalog/image')->init($_link, 'image')->resize(125) "

Now Flush Magento Cache and refresh page

Please check it and find out attached module you can also try it
Link : https://www.dropbox.com/s/yzbl26rr9lpsjbg/Magebug_Upsell.zip?dl=0

Hope this information is helpful to you :)

1 comment:

  1. Thanks for the best blog.it was very useful for me.keep sharing such ideas in the future as well.this was actually what i was looking for,and i am glad to came here!
    magento development company in bangalore 

    ReplyDelete