I want to iterate over all products in the product collection given in the block Mage_Catalog_Block_Product_List_Toolbar, ignoring the limits that were set before by "setPageSize()" and "setCurPage()". My approach looks like the following:
/** @var Mage_Catalog_Block_Product_List_Toolbar $this */
//...
$collection = $this->getCollection();
// Remove the LIMIT and OFFSET parts from the generated SQL query:
$collection->getSelect()->reset(Zend_Db_Select::LIMIT_COUNT);
$collection->getSelect()->reset(Zend_Db_Select::LIMIT_OFFSET);
// Reload the collection using the new SQL query:
$collection->load();
foreach($collection as $product)
{
// ...
}
// ...
The problem is, that the collection seems not to be reloaded, so the limits that were set before are still there. What am I missing here? Is the collection locked or something so that I can't change it?