Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

list.phtml filtering product collection not giving correct pagination
 
counterfoxx
Jr. Member
 
Total Posts:  29
Joined:  2012-08-07
 

I’m trying to filter list.phtml to suit my needs which is only showing products based of an value of the attribute. The original code to load the product collection is:

$_productCollection=$this->getLoadedProductCollection();
$_helper $this->helper('catalog/output');

To do the filtering I have got the code:

$_productCollection=$this->getLoadedProductCollection();

$cat_id Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
$_productCollection Mage::getResourceModel('catalog/product_collection')
   ->
addAttributeToFilter('language', array('eq' => array('English')))
   ->
addAttributeToSelect('*')
   ->
addCategoryFilter(Mage::getModel('catalog/category')->load($cat_id));


$_helper $this->helper('catalog/output');

This works however the pagination and items total number (generated from toolbar.phtml and pager.phtml are incorrect. For example the original product collection has the correct pagination of 7 pages and 10 products per page.

However when I use the filter shown above the pagination shows the same 7 pages and every filtered book on one page (there are 18 English books, so 7 pages of the 18 books which are duplicated).

Please can someone help me in solving this pagination issue.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top