Wednesday, September 30, 2015

Magento - Add new column (field) to credit memo items

If your extension wants to add a new field to each creditmemo item, then you should use this code in your extension's installer:

$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo_item'), 'cmsubtotal', 'FLOAT  DEFAULT 0');

For example, this code will add cmsubtotal field to creditmemo_item table. Once this is added, it is enough to use setCmsubtotal($value) function at each $creditmemoItem , before saving the model, to persist the custom field data into database.

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...