Printing a new field on the packing slip
Posted: Sat Feb 27, 2021 1:48 pm
Hi,
I wonder if someone could give me a few pointers to help me on my way.
I wanted to add a new field to each product to specify the physical location of the product and to have it print out on the packing slip.
This is what I thought I needed to do :-
1. Add a new field product_location to the products table in the database.
2. Add an extra tab on the admin side to allow the display and edit of the field when the product is displayed/edited using a hook in hooks\admin\categories.
3. Add a hook in hooks\admin\siteWide - listen_databaseOrderProductColumns() - which adds the field into the orders class so that it can be printed out. I can see that $parameters gets passed here << $GLOBALS['OSCOM_Hooks']->call('siteWide', 'databaseOrderProductColumns', $parameters); >> in database_order_builder.php but how do I access it in my hook ?
4. Add code to packingslip.php to print the product location next to the product model.
I have done 1 and 2, but I'm unsure how to access the $parameters array of the orders class to add the key and value to the array.
For step 4 I can see that I can change the core code, but could I use the << echo $OSCOM_Hooks->call('packingslip', 'extraComments') >> call to add it to each product line ? If so, would I do it via the DOM ?
I come from the world of C++/Java/Delphi programming so some of the coding, etc in PHP is unfamiliar to me.
Any help would be appreciated.
Thanks
I wonder if someone could give me a few pointers to help me on my way.
I wanted to add a new field to each product to specify the physical location of the product and to have it print out on the packing slip.
This is what I thought I needed to do :-
1. Add a new field product_location to the products table in the database.
2. Add an extra tab on the admin side to allow the display and edit of the field when the product is displayed/edited using a hook in hooks\admin\categories.
3. Add a hook in hooks\admin\siteWide - listen_databaseOrderProductColumns() - which adds the field into the orders class so that it can be printed out. I can see that $parameters gets passed here << $GLOBALS['OSCOM_Hooks']->call('siteWide', 'databaseOrderProductColumns', $parameters); >> in database_order_builder.php but how do I access it in my hook ?
4. Add code to packingslip.php to print the product location next to the product model.
I have done 1 and 2, but I'm unsure how to access the $parameters array of the orders class to add the key and value to the array.
For step 4 I can see that I can change the core code, but could I use the << echo $OSCOM_Hooks->call('packingslip', 'extraComments') >> call to add it to each product line ? If so, would I do it via the DOM ?
I come from the world of C++/Java/Delphi programming so some of the coding, etc in PHP is unfamiliar to me.
Any help would be appreciated.
Thanks