Sunday, September 25

How to Use SQL Queries in Magento

Most of time I have spend in finding proper sql queries for magento. And I have come to know that, its very good idea to not to use your personal sql query but use the magento syntax for doing such. Let me give you a good example to do this. We all are aware that we can use normal “is equal” query but have you ever tried to use “not null” ????

Try this syntax with your customization

$yourvariable = $layer->getProductCollection()->addAttributeToFilter(’special_price’,array(‘notnull’=>”));

I have used this to get only those products which has some special price assigned.

Hope it Helps... Thanks

No comments:

Post a Comment