Magento SetColumnCount Based on layout Selection – PHTML

I was worked lot of project for this layout based columncount on Magento Product listed page. But all time i was used only the XML solution. But that won’t work with multiple layout which is selected by admin on category layout section.

Now i can show the simple method to fix that problem on layout selection.

Go to the list.phtml file on your magento theme file.

There you can commend this line

[php]
$pageLayoutTemplate = $this->getLayout()->getBlock(‘root’)->getTemplate();

switch ($pageLayoutTemplate) {
case ‘page/1column.phtml’:
$_columnCount = 5;
break;

case ‘page/2columns-left.phtml’:
$_columnCount = 4;
break;

case ‘page/2columns-right.phtml’:
$_columnCount = 4;
break;

case ‘page/3columns.phtml’:
$_columnCount = 3;
break;

default:
$_columnCount = 4;
break;
}
[/php]

About the author: ShareSoftAdmin

Leave a Reply

Your email address will not be published.