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:
- Magento Commerce Error Reporting Tip
- Eclipse + ZendStudio + ZendServer + Android SDK = Awesome IDE
- Magento: Paypal Standard IPN Double Totals Bug 1.3.2.3 + fix
- iPhone Magento theme compatible with Android
- Magento Tutorial Video: Display Product Images in Blocks and Pages













October 29th, 2009 at 11:10 am
[...] Magento: Display a product image within Static Pages and Blocks … [...]
November 13th, 2009 at 6:18 am
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
November 13th, 2009 at 10:53 am
Hans,
Thanks for creating a video tutorial for this.