Magento: Display a product image within Static Pages and Blocks

In this particular instance I needed to add product thumbnails for reference on a front page.

First create a new .phtml file with the following under catalog/product/view/your_new_page.phtml

1
2
3
4
5
<?php
$productId = $this->getProduct_id(); 
$_product = Mage::getModel('catalog/product')->load($productId); //load the product
?>
<img src="<? echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75, 75); ?>" alt="<?php echo $this->htmlEscape($_product['name']); ?>" border="0" width="75" />

Now simply add the following to your CMS Page or Block and adjust the product ID to the product Image you wish to view:

1
{{block type="catalog/product_new" product_id="1" template="catalog/product/view/your_new_page.phtml"}}

Possibly Related Posts:


This entry was posted in Magento Commerce and tagged , , . Bookmark the permalink.

3 Responses to Magento: Display a product image within Static Pages and Blocks

  1. Pingback: Several Popular Technology Related Product Reviews -Wii Game Central

  2. Hi Jared,
    Thank you for this tutorial. I’ve used it to create a video tutorial from it.
    https://www.yireo.com/tutorials/magento-programming/183-video-dynamic-product-image-to-static-page

  3. admin says:

    Hans,

    Thanks for creating a video tutorial for this.
    8)

blog comments powered by Disqus