KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: Iruñea on January 07, 2010, 04:07:35 pm

Title: how to save data per product per order
Post by: Iruñea on January 07, 2010, 04:07:35 pm
Hello,

   Can I customize Konakart, in order to save some data with a product per EACH order ?
I explain myself with an example: In a shop selling Tshirts, the user selects a Tshirt belonging to PRINTABLE TSHIRTS category. The system then, should lets the user enter a phrase which will be printed in his Tshirt. This must be stored somewhere.

   I believe the correct place to store this info in the DB would be in orders_products Table (on custom1 field) because this data depends in the product and in the order. But even if I set the custom1 attribute to the basket object before checking out, I dont achieve it. How could I do this ?

Please any tip would be really useful

Thanks,
Iruñea
Title: Re: how to save data per product per order
Post by: trevor on January 07, 2010, 05:18:55 pm
Yes, that is the correct place to save this type of information.

If you are using the server engine API then you just have to set the options of the createOrderWithOptions API call. If you are using the client engine, then the createCheckoutOrder() API call defaults some of the parameters for you and the copyBasketCustomFields attribute of the CreateOrderOptions object is set to false. In the next version the default value will be true rather than false.

Maybe the easiest route for you to take is instead of calling kkAppEng.getOrderMgr().createCheckoutOrder() in CheckoutDeliveryAction to call the server engine directly so that you can set the options to copy the custom fields. Once you have the order, you must remember to give it to the client engine by calling kkAppEng.getOrderMgr().setCheckoutOrder(). 
Title: Re: how to save data per product per order
Post by: Iruñea on January 08, 2010, 10:47:33 am
Good to know about this "copyBasketCustomFields" option when creating the order.

Thanks a lot Trevor!
Iruñea  ;)