Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $collection = Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToFilter('col', array('eq' => $value));
- // Add a page size to the result set.
- $collection->setPageSize(25);
- $pages = $collection->getLastPageNumber();
- $currentPage = 1;
- do {
- // Tell the collection which page to load.
- $collection->setCurPage($currentPage);
- $collection->load();
- foreach ($collection as $item) {
- // do stuff
- // tip to save memory
- // $_child = Mage::getModel('catalog/product')->load($child->getId());
- // $_child->clearInstance();
- }
- // make the collection unload the data in memory so it will pick up the next page when load() is called.
- $collection->clear();
- $currentPage++;
- } while ($currentPage <= $pages);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement