23.02.2015 Views

www.it-ebooks.info

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3<br />

It is simple, isn't <strong>it</strong>? We could even add an add<strong>it</strong>ional cond<strong>it</strong>ion and get the products<br />

added between two dates. Let's say we only want to retrieve the products that were<br />

created in the month of December:<br />

$productCollection->addFieldToFilter('created_at', array('from' =><br />

'2012-12-01));<br />

$productCollection->addFieldToFilter('created_at', array('to' =><br />

'2012-12-30));<br />

Magento's addFieldToFilter supports the following cond<strong>it</strong>ions:<br />

Attribute code SQL cond<strong>it</strong>ion<br />

eq =<br />

neq !=<br />

like<br />

LIKE<br />

nlike<br />

NOT LIKE<br />

in IN ()<br />

nin NOT IN ()<br />

is<br />

IS<br />

notnull<br />

NOT NULL<br />

null<br />

NULL<br />

moreq >=<br />

gt ><br />

lt <<br />

gteq >=<br />

lteq

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!