Coming up: 24 Sep - Magento PWA Studio training

Yireo - Trainings & extensions

Open main menu

Video: Dynamic product image to Static Page

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 8 November 2009

Looking for a training in-house?

Let's get to it!

Do not miss out on what we say

This will be the most interesting spam you've ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Sign up for the Yireo newsletter

Extensions

Legal information

Other Yireo sites

Get Social

About Yireo