I have created a module to add a new option in 'sort by' dropdown box
in the category page. the new option should show in each and every
category page same as 'position' option which is already there. I want
to add 'popularity' as an option. My Model class is executing and it's
adding the option to the option array. But the block is not working.
Please I need your help to find the issue in my code?
Here is the Block class
<?php
class Tal_Popularity_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar{public function setCollection($collection){$this->_collection = $collection;$this->_collection->setCurPage($this->getCurrentPage());// we need to set pagination only if passed value integer and more that 0$limit = (int)$this->getLimit();if ($limit) {$this->_collection->setPageSize($limit);}if($this->getCurrentOrder() == 'popularity'){$this->_collection->sortByReview($this->getCurrentDirection());}else if ($this->getCurrentOrder()) {$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());}return $this;}}
following is my config.xml
<?xml version="1.0" ?><config><modules><Tal_Popularity><version>0.1.0</version></Tal_Popularity></modules><frontend><routers><popularity><use>standard</use><args><module>Tal_Popularity</module><frontName>popularity</frontName></args></popularity></routers></frontend><global><models><catalog><rewrite><config>Tal_Popularity_Model_Config</config></rewrite></catalog></models><blocks><catalog> <rewrite> <product_list_toolbar>Tal_Popularity_Block_Product_List_Toolbar</product_list_toolbar> </rewrite> </catalog><catalog> <rewrite> <catalog>Tal_Popularity_Block</catalog> </rewrite> </catalog> </blocks> <resources> <popularity_setup> <setup> <module>Tal_Popularity</module> </setup> <connection> <use>core_setup</use> </connection> </popularity_setup> <popularity_write> <connection> <use>core_write</use> </connection> </popularity_write> <popularity_read> <connection> <use>core_read</use> </connection> </popularity_read> </resources> </global> </config><rewrite> <product_list_toolbar>Tal_Popularity_Block_Product_List_Toolbar</product_list_toolbar></rewrite></catalog><catalog><rewrite><catalog>Tal_Popularity_Block</catalog></rewrite></catalog></blocks><resources><popularity_setup><setup><module>Tal_Popularity</module></setup><connection><use>core_setup</use></connection></popularity_setup><popularity_write><connection><use>core_write</use></connection></popularity_write><popularity_read><connection><use>core_read</use></connection></popularity_read></resources></global></config>
No comments:
Post a Comment