This tutorial explains how to create a dynamic product image to a Magento CMS Page. Within the CMS Page you still need to define which product-ID to use, but when the product image changes the CMS Page automatically shows the updated image.
Note: This information originally comes from molotov.bliss (www.molotovbliss.com). We've only used that information to create a video tutorial from it. Kudos to Jared.
Below is the code used in the video tutorial. It should be placed in your copy of app/design/frontend/default/default/template/catalog/product/view/your_new_page.phtml. Do not modify the original, but only make your changes within your own theming-directory.
<?php $productId = $this->getProduct_id(); $_product = Mage::getModel('catalog/product')->load($productId); ?> <img src="<? echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75, 75); ?>" alt="htmlEscape($_product['name']); ?>" border="0" width="75" />
Also, add the following to your own CMS Page or CMS Block. Adjust the product ID ("product_id") to point to the proper product whose image you wish to display:
{{block type="catalog/product_new" product_id="1" template="catalog/product/view/your_new_page.phtml"}}
About the author
Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.