About: Ron

Recent Posts by Ron

Find Out The SQL Query That Was Used To Retrieve A Collection

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

Changing The Select After The Collection Has Been Loaded

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.