As probably you know (or maybe not) in Magento you can add your own filters to every collection, basically it looks like:

So here is full list of conditions you may use:

1. “eq” – equals (x = 1): addAttributeToFilter(‘status’, array(‘eq’ => 1))
2. “neq” – not equals (x != 1): addAttributeToFilter(‘sku’, array(‘neq’ => ‘test’))
3. “like” – same as in sql, you can use % here: addAttributeToFilter(‘sku’, array(‘like’ => ‘%test%’))
4. “nlike” – not like: addAttributeToFilter(‘sku’, array(‘nlike’ => ‘%test%’))
5. “in” – same as IN() used in sql, accepts array of values: addAttributeToFilter(‘id’, array(‘in’ => array(1,2,3)))
6. “nin” – not in: addAttributeToFilter(‘id’, array(‘nin’ => array(1,2,3)))
7. “null” – field should equal to null: addAttributeToFilter(‘description’, ‘null’)
8. “notnull” – field should be different then null: addAttributeToFilter(‘description’, ‘notnull’)
9. “gt” – greater then (x > 1): addAttributeToFilter(‘id’, array(‘gt’ => 1))
10. “lt” – less then (x < 1): addAttributeToFilter(‘id’, array(‘lt’ =>1))
11. “gteq” – greater or equal (x >= 1): addAttributeToFilter(‘id’, array(‘gteq’ => 1))
12. “lteq” – less or equal (x <= 1): addAttributeToFilter(‘id’, array(‘lteq’ => 1))

If you want to see executed SQL try:


Such error happens in 1.7.x branch (I saw it in 1.7.2), when entering database parameters you’re seeing “PHP Extensions “0” must be loaded” instead of next step. This is internal Magento bug, you can correct it by finding file app/code/core/Mage/Install/etc/config.xml  and replacing:


During configuration of Magento (in fact whole 1.7.x branch) you may encounter such error:

Database server does not support InnoDB storage engine

Of course your MySQL server has InnoDB enabled so what to do? Answer is simple but ugly, go to app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php and replace:


It is a common issue, you added:


but filtering just shows ajax spinner and not loading content? Check your grid class ([COMPANY]_[MODULE]_Block_Adminhtml_[CONTROLLER]_Grid extending from Mage_Adminhtml_Block_Widget_Grid) and if you don’t have getGridUrl(), it is the reason. Just add as shown:

keep in mind to match ‘*/[CONTROLLER]/grid’ to your controller, it should be gridAction() method in controllers/Adminhtml/[CONTROLLER]Controller.php with such content:

Po ponad dwóch latach prowadzenia bloga postanowiłem zmienić jego koncepcję – pierwotną ideą było pisanie o rzeczach które trudno wygooglować albo do których nie udało mi się znaleźć gotowego rozwiązania. Jednak jak widać po ilości postów wielu takich rzeczy nie ma, więc zamiast powielać coś co już inni napisali lepiej będzie pisać o tym samym (koniec końców 90% treści w internecie to przeredagowane kopie czegoś co już było) ale po naszemu. Czy okaże się to słuszne – zobaczymy.

Well, first rule – you should not do this. But if there is good reason, consider using such query for searching in index-based arrays:

In case you have assoc array serialized you can use:

Of course it won’t be very fast but in small tables should be enough

We all know Facebook SDK. It should be marked as beta. Or even alpha. Some things works one day, and few days after they are not. Such situation happened with sharer.php and its mobile browser detection. Using iPad 1 with iOS 5.1.1 (so it’s Safari 5.1) caused facebook to stay at its full version, but using device with iOS 7 (with Safari 7.0) triggered redirection to “So what?” some of you may thing. Well, nothing except broken sharing dialog. The solutions is not easy to google, but very simple – just add m2w as GET parameter and it will stick at full version this way:

Yes, it can be really painfull – MSSQL (at least instance I’m using) is saving date in format “d/m/Y H:i:s” but in every part of code I had “Y-m-d H:i:s”. So what now – rewrite everything? Nope, there is ugly but working way to do it, after ADODb object is created and initialized put:

and that’s it – all dates will be internally converted to given format, so here is full example of config: