To find out the SQL query Magento uses to retrieve a specific collection, just do the following: Let’s say you would like to know what query is used to get a product collection – go to your debugging area (or maybe some phtml file), and paste following code: $_productCollection = Mage::getResourceModel("catalog/product_collection");...
Read more
About: Ron
Recent Posts by Ron
Changing The Select After The Collection Has Been Loaded
Posted in: Working With Magento Collections | , by Ron
Lets observe at the following example: For some reason you want to show the products whose price is lower than 100$. If you go to list.phtml at app/design/frontend/base/default/template/catalog/product, you will see the following line: $_productCollection=$this->getLoadedProductCollection(); $_productCollection is instance of Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection, and of course this is already loaded collection (collection that has items)....
Read more
Recent Comments by Ron
No comments by Ron yet.