Magento addAttributeToFilter SQL Conditionals
If you want to customize query or product collection data you can easily to do that with addAttributeToFilter funcation in magento. In short you can easily customize product collection select query based on your requirement in magento development. [php] <?php $collection = Mage::getModel('catalog/product')->getCollection(); ?> [/php] If you want get all fields then use below condition select [php] <?php $collection->addAttributeToSelect('*'); ?> [/php] If you want to get limited fields then use below condition [php] <?php $collection->addAttributeToSelect(array('name', 'product_url', 'small_image')); ?> [/php] [php] <?php $collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect(array('name', 'product_url', 'small_image')) ->addAttributeToFilter('sku', array('like' => 'test-product%')) ->load(); ?> [/php] The above code would get a product collection which contain only products that have an SKU starting with "test-product". addAttributeToFilter Conditionals [php] <?php // Is Equal To (eq) $collection->addAttributeToFilter('status', array('eq' => 1)); // Is Not Equal…