If you want to convert a cms page into product view page, simply adding produt.info
block directive inside CMS Page will not be sufficient. This is because default product view page has lot of other product page specific blocks and they will not get rendered if you use the directive method.
If you want to get the exact "carbon copy" of product page in a CMS Page, then you need to observer to the event cms_page_render
and then do your magic there. ie you need to do this.
<?php
class Namespace_Module_Model_Observer
{
const CMS_PAGE_IDENTIFIER = 'test-page';
const PRODUCT_ID = 418;
public function convertToProductPage(Varien_Event_Observer $observer)
{
//getting event data
$page = $observer->getEvent()->getPage();
$action = $observer->getEvent()->getControllerAction();
//verify the right page and add `catalog_product_view` handle
if ($page->getIdentifier() == self::CMS_PAGE_IDENTIFIER) {
$action->getLayout()->getUpdate()
->addHandle('catalog_product_view');
//register product
$product = Mage::getModel('catalog/product')->load(self::PRODUCT_ID);
if ($product instanceof Mage_Catalog_Model_Product) {
Mage::register('product', $product);
Mage::register('current_product', $product);
}
}
return $this;
}
}
Here we are doing two things. First it will update layout with hadle catalog_product_view
. This will eventually convert a cms page with product page layout. Second thing is we are then registering the required product. Mage::registry('product')
and Mage::registry('current_product')
need to be defined because, most of the blocks in product page are using those registries.
Note 1 : Here is the complete reference to the source code of this simple extension. Feel free to use it :).
Note 2 : Dont forget to change the value of constant CMS_PAGE_IDENTIFIER
and PRODUCT_ID
with your cms page identifier and product id.