I want to add Sales Representative name in Order View page and Invoice PDF for the orders placed via Admin.
For the same I need to add a column to order table which will have the admin name.
After searching over internet I have figured out some points to note:
The correct observer to capture the data when the admin creates a new order is adminhtml_sales_order_create_process_data
.
I do not want this observer to be triggered when frontend orders are placed. (Only admin backend created orders). For the same I will place my event observer code into the <adminhtml>
node in my module's config.xml file instead of <global>
.
However I want to know the process how I can add column to the table.
Best Answer
I wrote a InstallSchema.php in my custom module to add a column(sales_repesentative) to sales_order table.
Created events.xml (app/code/Store/Sales/etc/adminhtml/events.xml)
Created an observer AdminCheckoutSubmitAllAfter.php to save the admin user name to the newly created column.
and then got the sales representative like this