Question

What is the best method of adding new attributes to the sales and/or quote tables in magento via an install script:

use: addColumn() or use addAttribute() ?

So the main questions are :

What is the best if in the future I need to migrate to a new version (I m on CE 1.7) ? What is the best for performance ?

I need to display this custom data in the admin back end order grid, so what is the best choice for that too (performance & usability) ?

Thank you in advance !

Was it helpful?

Solution

Just so this question would have an answer.

If you are creating an extension for version 1.4.0.0 and below you need to use addAttribute because the sales objects were EAV up to that version.

For versions starting with 1.4.0.1 you can use both addAttribute and addColumn.
They basically do the same thing for backwards compatibility.

If you don't know the version for which you are developing (or developing for all of them) use addAttribute. It's safer.

And don't worry about performance in the install/upgrade scripts. The scripts are executed only once and you shouldn't make upgrades when the site is live. So you should be the only one that is viewing the website when the upgrade is done.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top