xml - Magento Category Pages: Change layout of specific categories from grid mode to list mode -
i want category pages in list mode , start 30 items displayed want category page in grid mode , fewer items displayed.
i understand can updating custom layout xml through admin panel, i'm not sure exact xml be.
my solution create module overrides toolbar class controls grid/list view of catalog , number of items display.
the specific class override called mage_catalog_block_product_list_toolbar. clone file , add following method it:
/** * sets current view mode (grid, list, etc.) * * @param string $mode */ public function setcurrentmode($mode) { $this->setdata('_current_grid_mode', $mode); } you need create config.xml file it.
<!-- app/code/local/example/catalog/etc/config.xml --> <?xml version="1.0"?> <config> <global> <blocks> <catalog> <rewrite> <product_list_toolbar>example_catalog_block_product_list_toolbar</product_list_toolbar> </rewrite> </catalog> </blocks> </global> </config> now, in admin panel, change layout of category, go catalog > manage categories , select category wish change. go custom design tab , in field labelled custom layout update, enter following xml code:
<reference name="product_list_toolbar"> <action method="setcurrentmode"> <mode>list</mode> </action> </reference> of course, remember flush layout caches of magento or change won't appear.
Comments
Post a Comment