Thanks in advance,
I want to change the product listing page layout dynamically..
The question is that if in the list.phtml if i click on grid link the layout of the list.phtml file should be 2columns-right.phtml and if i click on list link the layout should be 2columns-left.phtml
i have used following code for this but no luck yet ..
if($this->getMode() == 'grid' && $this->getLayout()->getBlock('root')->getTemplate() != 'page/2columns-left.phtml'):
$this->getLayout()->getBlock('root')->setTemplate('page/2columns-right.phtml');
elseif($this->getMode() == 'list' && $this->getLayout()->getBlock('root')->getTemplate() != 'page/2columns-right.phtml'):
$this->getLayout()->getBlock('root')->setTemplate('page/2columns-left.phtml');
endif;
var_dump($pageLayout=$this->getLayout()->getBlock('root')->getTemplate());
does any one have done this before..