View Single Post
  #2  
Old 10-31-2018, 04:50 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Adding order meta data and displaying it places!

Hi Navin,

Thanks for choosing X-Cart and welcome to X-Cart forums!

Quote:
Originally Posted by NavinSeth
I currently have the following scenario and need some guidance.

I would like to add a piece of meta data to an order when it is created and include that data on the invoice template for the order. For argument sake let's call this data orderColor.

1) How do I create a new column to the gbxc5_orders table? (orderColor column).

The process of adding a new property to the model is described here:
https://devs.x-cart.com/basics/adding_new_property_to_a_product/#decorating-model-class

This example is for \XLite\Model\Product class, but you can decorate \XLite\Model\Order class all the same. Although, you will be adding orderColor property instead of myMessage.

Quote:
2) How do I populate orderColor when the order is created?

\XLite\Model\Order class has the processSucceed() method that is run when you place an order. You should decorate it and put the code of defining processSucceed property there.

Quote:
3) How do I show the orderColor on the invoice when a admin user views the order AND when the invoice is emailed on order creation event?
4) How do I show the orderColor column on the packing slip?[/quote]

These tasks are similar to one described here: https://devs.x-cart.com/design_changes/adding_product_images_to_order_notifications.html

Please, have a look at the article and you find any difficulties, please let me know.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote