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.

{youtube uKAO1rrN6kw}

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"}}
Posted on November 8, 2009

About the author

Author Jisse Reitsma

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.

Sponsor Yireo

Looking for a training in-house?

Let's get to it!

We schrijven niet te commerciële dingen, we richten ons op de technologie (waar we dol op zijn) en we komen regelmatig met innovatieve oplossingen. Via onze nieuwsbrief kun je op de hoogte blijven van al deze coolness. Inschrijven kost maar een paar seconden.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We schrijven niet te commerciële dingen, we richten ons op de technologie (waar we dol op zijn) en we komen regelmatig met innovatieve oplossingen. Via onze nieuwsbrief kun je op de hoogte blijven van al deze coolness. Inschrijven kost maar een paar seconden.