Archive for July 2017

SQL Query IN and NOT IN

Magento uses keywords in for IN and nin for NOT IN …   $productIds = array(1251,1253,1256);   if ($column->getFilter()->getValue()) { $this->getCollection()->addFieldToFilter(’entity_id’, array(’in’=>$productIds)); } else { $this->getCollection()->addFieldToFilter(’entity_id’, array(’nin’=>$productIds)); } …

What is the difference of addAttributeToFilter() Vs addFieldToFilter()?

addAttributeToFilter() is used to filter EAV collections. addFieldToFilter() is used to filter Non-EAV collections.

Re-use existing layout

tag is used for re-usage of existing layout   <vendorname_modulename_constrollername_indexaction>   <reference name="myreferencename"> <block type="vendorname/blockname" name="modulename_blockname" template="storelocator/template.phtml"> </block> </reference>   </vendorname_modulename_constrollername_indexaction>   <vendorname_modulename_constrollername_listaction>   <update handle="vendorname_modulename_constrollername_indexaction"/>   </vendorname_modulename_constrollername_listaction>