I\'m trying to do my category view display products in list or grid mode as default.
You can set grid or list from backend
System->Configuration->Catalog->Frontend->List mode
You can do this in the layout XML or the "Custom Layout Update" section in admin with the following xml:
<reference name="product_list_toolbar">
<action method="setData"><key>_current_grid_mode</key><value>list</value></action>
</reference>
Be sure, the toolbar block name was set in the product list block like this:
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
If you choose to use the method described by @rengaw83, you will not be able to switch between modes in that category anymore. For instance, if you click on "Grid", the mode will not change to grid mode.
To be able to switch modes and just set the default view mode in a category via a custom layout, you need to override the core Toolbar block, and add the following method to it:
/**
* Sets the current View modes (grid, list, etc.)
*
* @param array $modes
*/
public function setCurrentModes($modes)
{
$this->_availableMode = $modes;
$modes = array_keys($this->_availableMode);
$defaultMode = current($modes);
$mode = $this->getRequest()->getParam($this->getModeVarName());
if ($mode) {
if ($mode == $defaultMode) {
Mage::getSingleton('catalog/session')->unsDisplayMode();
}
} else {
$mode = Mage::getSingleton('catalog/session')->getDisplayMode();
}
if (!$mode || !isset($this->_availableMode[$mode])) {
$mode = $defaultMode;
}
$this->setData('_current_grid_mode', $mode);
}
Then you will be able to set modes in custom layout tab like that:
<reference name="product_list_toolbar">
<action method="setCurrentModes">
<modes>
<list>List</list>
<grid>Grid</grid>
</modes>
</action>
</reference>
for default list mode, or
<reference name="product_list_toolbar">
<action method="setCurrentModes">
<modes>
<grid>Grid</grid>
<list>List</list>
</modes>
</action>
</reference>
for default grid mode. Or you even can pass only one mode to set only grid or list mode available.