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.
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="<?php echo $this->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"}}
Created on Monday, 09 November 2009Modified on Sunday, 06 December 2009
More tutorials in this section
- Set the default direction or ordering for Magento category-pages
- Build your own Magento override-module
- Video: Replace Magento Checkout Button image with CSS
- Video: Modify the Magento Default Theme
- Video: Custom column layout
- Video: Magento Developer Toolbar
- Video: Add CSS to a single Magento CMS page
- Video: Dynamic product image to Static Page
