Sunday, February 8, 2015

Get MySQL Query String

$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('name');
$collection->addAttributeToFilter('small_image', array('notnull' => ''));
$collection->setOrder('name', 'asc');
$collection->load();
echo '<pre>' . $collection->getSelect()->__toString() . '</pre>';

No comments: