Maybe someone will find it usefull:


It is a bit different then method showed in previous post – this time its not transactional email sent at demand, but we will catch event fired after invoice is generated. So (I suppose you have your module already) in etc/config.xml add:

Then create your class at app/code/local/YourVendor/YourModule/Model/Observer.php (or use existing one) and add new method:

And invoice will be attached to email defined at:

Zrzut ekranu 2015-01-14 o 19.12.17

Seems to be complex, but its not that bad:

About $vars variable – in this one you can put everything which is set inside email template as variables.

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: