Search This Blog

Jun 21, 2011

Magento: Resizing Product Thumbnail on Magento Cart page


Today, I will show you simple tips on how to resize shopping cart thumbnail sizes. Magento automatically set a default sizes for product thumbnail in the cart which basically done in controller section.

The cart page product table is residing in default.phtml which is located to /app/design/frontend/[your_package]/[your_theme]/template/checkout/cart/item/default.phtml .

So, to override the default size you need to change the following number parameter in the following code fpr the above phtml file.

->resize(75);

The default size is 75 px.

<td><?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?></td>
    <td>

Please don’t forget also to change the width and height attribute. After changing upload the file, clear your magento cache and refresh the page.

1 comments:

Adjackson924 said...

Is there any way to call a different image other than the 'Thumbnail' on this page? i.e call the small image?

Cheers
Adam