Thursday 30 April 2015

Print query in magento

/----------Get products collection --------------/
  1. <p>$allproducts = Mage::getModel('catalog/product')-&gt;getCollection()-&gt;addAttributeToSort('name', 'ASC');;</p>
It will return you total products, sorted by name in ascending order from magento database. To print query write the below statement :-
  1. <p>echo $allproducts-&gt;getSelect();</p>

For such more Blogs you can visit to http://findnerd.com/NerdDigest


No comments:

Post a Comment