How to set Customer Tag Values in Java code

The KonaKart Store Front Server eCommerce Engine has methods to get and set the customer tags. These methods are:

The CustomerTag object has getter and setter methods to set and read data as BigDecimal, Boolean, Date, Int, Int Array and String. These methods should be used rather than setting the tag value directly as a String because the internal representation of the tag data may change over time.

The best way of seeing how the customer tag data is set in the store front application is to look at the source code of the Struts Action classes where this data is set using the Client Engine. Here are a few examples:

ShowProductDetailsAction.java


  // Set the PRODUCTS_VIEWED customer tag for this customer
  kkAppEng.getCustomerTagMgr().addToCustomerTag("PRODUCTS_VIEWED", selectedProd.getId());

QuickSearchAction.java


  // Set the SEARCH_STRING customer tag for this customer
  kkAppEng.getCustomerTagMgr().insertCustomerTag("SEARCH_STRING", searchText);

EditCustomerSubmitAction.java


  // Set the BIRTH_DATE customer tag for this customer
  CustomerTag ct = new CustomerTag();
  ct.setValueAsDate(d);
  ct.setName("BIRTH_DATE");
  kkAppEng.getCustomerTagMgr().insertCustomerTag(ct);