can we add a new column to the table s_orders

Hi

Can we add a new column to the order DB table s_orders. If so how what  all steps has to be done in the /Models/Order/Order.php and any other files if necessary

 

Thx for any help

Hi jijo,

no you’re not supposed to create new columns in any table except the *_attributes tables. Never ever touch any Shopware core files. You should use the plugin-system for any modification.
There’s a tutorial about Shopware’s attribute system in the developer documentation. Attribute system.
The table you’re looking for would be the s_orders_attributes.

A common practice i’ve seen, while using this in plugins, is to create a new table called s_plugin_PLUGINNAME. There you reference to a orderID or whatever

@brettvormkopp schrieb:

A common practice i’ve seen, while using this in plugins, is to create a new table called s_plugin_PLUGINNAME. There you reference to a orderID or whatever

I think this only makes sense for 1:n relations and should be considered as bad practice for 1:1 relations. For 1:1 relations you should refer to the attribute tables. The attribute system also retrives the data for you so you don’t have to make a separate database request.