Magento Print Query of Collection

Posted: July 16, 2012 in Magento
Tags: , ,

We can print query of collection using “getSelect()->__toString()”

$products = Mage::getModel(‘catalog/product’)
->getCollection()->addStoreFilter(1)
->addAttributeToFilter(‘status’, array(‘eq’ => 1))
->addAttributeToFilter(‘status’, array(‘eq’ => 1))
->addAttributeToSelect(‘name’)
->addFieldToFilter(‘attribute_set_id’, 10);
echo $products->getSelect()->__toString();

About these ads
Comments
  1. rs says:

    thnks bro its help me a lot..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s