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

Magento category page pagination is not working properly
 
user1234
Jr. Member
 
Total Posts:  3
Joined:  2013-07-09
 

I have modified the category product collection in my module. And overridden the class Mage_Catalog_Block_Product_List. I have created a new function and did some filtering with the product collection returned from _getProductCollection() function. My function is as below. $productActiveFrom , $productActiveTo , $merchantName are product attributes.

protected function _getFilteredProductCollection()
    
{
        $filteredCollection 
= new Varien_Data_Collection();     
        
$prodCollection $this->_getProductCollection();

        foreach(
$prodCollection as $product)
        
{
            $prod 
Mage::getModel('catalog/product')->load($product->getId());
            
$productActiveFrom strtotime(trim($prod->getProductActiveFrom()));
            
$productActiveTo strtotime(trim($prod->getProductActiveTo()));
            
$currentDate strtotime(date('Y-m-d'Mage::getModel('core/date')->timestamp(time())));

            if(
$productActiveFrom != '' && $productActiveTo != '')
            
{
                
if((strtotime($productActiveFrom) <= strtotime($currentDate)) && (strtotime($currentDate) <= strtotime($productActiveTo)))
                
{
                    $merchant 
$this->getMerchantName($product->getId())->getData();
                    if(
$merchant['is_active'== 1)
                    
{
                        $filteredCollection
->addItem($product);
                    
}
                }
            }
        }
        $this
->_productCollection $filteredCollection;
        return 
$this->_productCollection;
    
}
Wherever the _getProductCollection() function is called in Mage_Catalog_Block_Product_List block file, I have called _getFilteredProductCollection() instead.

Products are filtering as I expected. But the pagination is not working properly. It loads all the products in one page. Even though it shows page numbers as 1,2,3, etc. when I click on any page number it shows all the products.

I have tried all the solutions mentioned in web. But none of them worked out. Please any help will be appreciated.

Image Attachments
pagination.png
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top