Let you have write a product collection with some attribute to select some product, but you are not getting proper result then you must need to print the sql query to see whether you have write the correct syntax in magento default collection. then write the below code to get the sql query .
<?php
$productcollection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('bestseller', array('eq' => 1))
->addAttributeToSelect('*');
echo $productcollection->getSelect()->assemble();
?>
No comments:
Post a Comment