Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <reference name="product_list_toolbar">
- <action method="addPagerLimit"><limit>20</limit></action>
- <!--action method="setDefaultGridPerPage"><limit>20</limit></action-->
- <!--action method="setDefaultListPerPage"><limit>20</limit></action-->
- </reference>
- <layout>
- <CATEGORY_13>
- <reference name="product_list_toolbar">
- <action method="addPagerLimit"><mode>grid</mode><limit>15</limit></action>
- <action method="addPagerLimit"><mode>list</mode><limit>15</limit></action>
- </reference>
- </CATEGORY_13>
- <CATEGORY_7>
- <reference name="product_list_toolbar">
- <action method="addPagerLimit"><mode>grid</mode><limit>30</limit></action>
- <action method="addPagerLimit"><mode>list</mode><limit>30</limit></action>
- </reference>
- </CATEGORY_7>
- </layout>
- <?php
- class Namepace_Modulename_Model_Observer {
- /**
- *
- * Holds Categoy ids
- *
- * @var array
- *
- */
- protected $_categoryIds = array(13,7) ;
- /**
- *
- * Holds page Sizes
- *
- * @var array
- *
- */
- protected $_pageSize = array(
- 13 => 15
- 7 => 30
- ) ;
- /**
- *
- * Use to set Page Size
- *
- * @param Varint Object | $observer
- *
- *
- */
- public function setPageSizeForCategory($observer)
- {
- $controller = $observer->getAction();
- $fullActionName = $controller->getFullActionName();
- $id = (int)$controller->getRequest()->getParam('id');
- //check whether current page is correspond to our special category. If not, returns
- if ($fullActionName == "catalog_category_view" && $id == in_array($this->_categoryIds)) {
- //check whether toolbar block exist or not
- $toolbar = $controller->getLayout()->getBlock('product_list_toolbar');
- if($toolbar) {
- //sets page size to corresponding mode
- $listMode = $toolbar->getCurrentMode();
- $toolbar = $toolbar->addPagerLimit($listMode , $this->_pageSize[$id]);
- }
- }
- return;
- }
- }
Add Comment
Please, Sign In to add comment