• Welcome to KonaKart Community Forum. Please login or sign up.

Adding custom basket fields

Started by petkow, September 20, 2013, 11:42:08 am

Previous topic - Next topic


I am completely new to konakart and relatively new to Java as well so please pardon my ignorance! I have spent quite a while trying to figure out how to enable some additional fields related to the customisation of an order. For example, lets say my product is a T-Shirt, and I allow the customer to define the text to appear on the T-Shirt. Seems to be a fairly straight forward request, but I have been researching this in the documentation and here in the forum and I am not really finding easy answers. The best I could find was described in this post: http://www.konakart.com/forum/index.php?topic=1466.0.

I have defined an additional Product Option and then in the product, I go into the attributes tab and add this option to the product. Now my first question: I presume I need to define something in the C1 and C2 fields of this option in order to store the custom text? It says in the help text: "The attributes C1 and C2 are custom values that may be set with custom data." Or am I barking up the wrong tree?

Can someone lead me in the right direction?

Thanks in advance


The link you gave is still accurate:

QuoteYou put the text in custom basket fields when the product is added to the basket. When an order is created, these custom fields will be copied to the OrderProduct custom fields so every line item of the order can have its own custom values.

So you just add a text entry field to the JSP where a customer can enter the text. When the T-Shirt is added to the basket you put the text in one of the basket object custom fields.  When the order is created the text will automatically be added to the corresponding OrderProduct custom field. The OrderProduct represents a line of the order containing the T-Shirt.

No need to define a product option. You should use those for colour and size.


Thanks for the very quick reply ryan. So, I take it from your answer that there are always a certain number of basket object custom fields that are available regardless of the settings that I define in Product options, custom attributes etc.? I take it I then have to add it using setCopyBasketCustomFields (from  http://www.konakart.com/javadoc/server/com/konakart/appif/CreateOrderOptionsIf.html

Am I heading in the right direction? Do you by any chance have any examples of the specific lines of code I could implement?


That's right. Before trying it out in the application you can play around with one of the examples we ship. Try running and editing KonaKart\java_api_examples\src\com\konakart\apiexamples\InsertOrder.java .


Thank you very much Ryan. Posting that full path has saved me a load of time, and I can see that that example is loaded with really useful comments and explanations. Thank you!


Sorry I am still a bit lost.  :-\ I am following through the InsertOrder example and it makes sense. However, if I subsequently want to add a text area field, I presume I could so in the default shopfront in CatalogCheckoutOnePageBody.jsp (for example). Is this right? I also could not find any action with any reference to BasketCustomFields. (I am looking in /konakart/custom/appn/src/com/konakart/actions)

Once again, excuse my complete lack of understanding and thank you