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

When I select page 2 of products in a category it still displays the previous page. 
 
eliteeternity
Member
 
Avatar
Total Posts:  74
Joined:  2008-07-16
 

In other words, I have my store defaulted to show 9 products in the beginning. If you go to my page with products, it displays all the products instead of just 9. Then when you click on “2” to see page 2, it displays the same content. A demo is here: http://www.skyjapanshop.com/anime-dvd/a-c/index.html?p=2&mode;=grid
Anybody know what’s going on? Gosh playing forum tag with no support is getting real old.
I wish the magento team ever responded.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Anton Makarenko
Magento Team
 
Avatar
Total Posts:  184
Joined:  2008-05-13
Los Angeles, CA
 

Looks like products collection is loaded before it is set (or not set at all) to toolbar block, so the toolbar block cannot affect it.
Open Mage_Catalog_Block_Product_List_Toolbar::setCollection() and debug, is it called and when.

It is obviously, that collection must be affected before this code in catalog/product/list.phtml:

<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php 
if(!$_productCollection->count()): ?>

In other words, you should determine, what is happening in Mage_Page_Block_Html_Pager::setCollection() - in this place the collection is affected:

public function setCollection($collection)
    
{
var_dump
($this->getCurrentPage());
var_dump($this->getLimit());
mageDebugBacktrace();
exit;
        
$this->_collection $collection
            
->setCurPage($this->getCurrentPage());
        
// If not int - then not limit
        
if ((int) $this->getLimit()) {
            $this
->_collection->setPageSize($this->getLimit());
        
}

        
return $this;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
eliteeternity
Member
 
Avatar
Total Posts:  74
Joined:  2008-07-16
 

hmm....thanks for the insight. Can anybody put that into noob terms so I can do something to solve my problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
WhoIsGregg
Member
 
Total Posts:  64
Joined:  2008-09-02
Tampa, Florida
 

@Anton: Is there a way to setLimit() in the same .phtml file that calls getLoadedProductCollection()? Or is it too late by the time the script gets to that point?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rinku
Member
 
Total Posts:  41
Joined:  2008-09-17
New Delhi
 

Hello All,

I have same problem, I have approx 1500 records in product collection. But I want only 100 products to show. Kindly let me know how can I set limit in product collection.

here is my code.

$this->_productCollection = Mage::getResourceModel(’reports/product_collection’)
->setStoreId($storeId)
->addAttributeToFilter(’visibility’,$visibility)
->addAttributeToSelect(’*’)
->addViewsCount()
->joinAttribute(’status’, ‘catalog_product/status’, ‘entity_id’, null, ‘inner’)
->addAttributeToFilter(’status’,1);

Thank you.
Sandeep

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