Skip to content

Instantly share code, notes, and snippets.

@deivisonarthur
Forked from anonymous/filtro2.php
Created January 7, 2013 18:55
Show Gist options
  • Save deivisonarthur/4477448 to your computer and use it in GitHub Desktop.
Save deivisonarthur/4477448 to your computer and use it in GitHub Desktop.
$results = Mage::getModel('xyz/abc')->getCollection();
$results->addFieldToSelect('name');
$results->addFieldToSelect('keywords');
$results->addOrder('name','ASC');
$results->setPageSize(5);
$results->getSelect()->where("keywords like '%foo%' or additional_keywords like '%bar%'");
$results->load();
echo json_encode($results->toArray());
link: http://stackoverflow.com/questions/3826474/magento-addfieldtofilter-two-fields-match-as-or-not-and
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment