I found an observer and modified it a bit which should overwrite the standard product layout. This works, however, if I have cache enabled it keeps loading my page from cache.
What I actually need is, that as soon as the GET parameter "template" is set the page should be cached so I don't have any problems.
Normal product ie: http://www.website.com/product.html Product in popup: http://www.website.com/product.html?template=popup
With cached disabled it works, enabled it doesn't. Hope somebody can help me.
Here's the observer.php
class Unleaded_ForceLayout_Model_Observer
{
public function changeLayoutEvent($observer)
{
$action = $observer->getEvent()->getAction();
$layout = $observer->getEvent()->getLayout();
if(($action->getRequest()->getControllerName() == 'product' && $action->getRequest()->getActionName() == 'view'))
{
$template = $action->getRequest()->template;
if (isset($template) && $template != '')
{
$cache = Mage::app()->getCacheInstance();
$cache->banUse('full_page');
$update = $layout->getUpdate();
$update->load($template);
$layout->generateXml();
}
}
}
}
And the XML
<?xml version="1.0"?>
<layout version="0.1.0">
<default></default>
<popup translate="label">
<label>Catalog Product View Popup</label>
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate">
<template>page/popup.phtml</template>
</action>
</reference>
<reference name="content">
<remove name="catalog.product.related"/>
<remove name="product.attributes"/>
<remove name="product.info.upsell"/>
<remove name="product.description"/>
<remove name="product.info.additional"/>
<remove name="product.description"/>
<remove name="product.info.container1"/>
<remove name="product.info.container2"/>
</reference>
</popup>
</layout>
unsetChildren()might be a cleaner choice for yourcontentupdates. – benmarks Aug 30 '13 at 18:06