Adding a single product to a static block or CMS page
I have been playing with this for my shop home page.
The following works ok for me:
in the CMS, modify the homepage, setting the content to: <div class="product-info-box">
<div class="product-essential">
{{block type="catalog/product_view" product_id="21" template="catalog/product/home.phtml"}}
<div class="product-img-box">
{{block type="catalog/product_view_media" product_id="21" template="catalog/product/view/home-media.phtml"}}
div>
<div class="product-shop">
<h1>Home Pageh1>
<div class="collateral-box">
<div class="head">
<h4>Work in Progressh4>
div>
{{block type="catalog/product_view" product_id="21" template="catalog/product/view/home-description.phtml"}}
div>
div>
div>
div>
<reference name="head">
<action method="addJs"><script>varien/product.jsaction>
reference>
ensure each .phtml file is in your frontend design that you are using (I renamed them from their defaults just to avoid conflicts)
the content of home.phtml is simply as follows
= $this->getProduct_id();
$product = Mage::getModel('catalog/product')->load($productId); //load the product
?>
the shop front can be seen at http://www.heydayonline.co.uk
Cheers
Hotchand Bhatia
Hello there,thanks for the tutorial.Is it possible to get it work with bundle products?Thanks
ReplyDelete