I'm aware that there are multiple different ways of adding a custom column to the order grid, from overloading the block to custom layout handle with event observer for loading data. My question is more about where this custom data should be stored. Historically speaking we have achieved this by adding custom columns to the sales_flat_quote
, sales_flat_order
and sales_flat_order_grid
tables as appropriate and copying the data over using the fieldsets in the configuration.
This process works and has suited our needs to this point, however modification of core tables in this manner feels a little dirty. This approach could cause issues with later upgrades to Magento and multiple modules working in this manner could cause compatibility issues with third party modules. This seems especially concerning in the case of us deciding to distribute an extension.
The only other approach that springs to mind is if our Cool_Feature
extension was to create it's own cool_feature_order_extra
table, probably with a foreign key reference to the sales_flat_order
table, that we can then join whenever we need the information.
- Is there a alternative (neater?) approach which I've neglected?
- Is there a 'Magento best practice' way of doing it?
- Has anybody ran into any issues with either approach?