7

For a Business Requirement we need to create some custom triggers for SmartTarget 2014 SP1. For Example

  • Product Type: Multiple values
  • Product Category: Multiple Values
  • Product Attributes: Multiple Values

My understanding as of now on SmartTarget is I need to add my custom trigger values TriggerType.xml, This way these trigger will appear in SmartTarget UI and an author can create promotions on these triggers.

As per the requirement these Products can be updated in backend so I need to update TriggerType.xml programatically and need to reload TriggerType.xml using HTTP Get.

So My questions are

  1. Is there any other way to achieve this?
  2. What changes I need to make in SmartTarget cartridge?
  3. Will I require to create Custom Cartridge to pass claim to Fredhopper?
  4. Any Documentation location where I can learn how to create a custom trigger?

Thanks

6
  1. Although not part of the official public API, I would recommend using the TriggerTypesHelper class to create/update the triggers - as well as the LocalizationHelper class if you need to use different labels than the raw values (for instance, we use the URI of Segments as the trigger values but show the title to users when editing Promotions).

You should not need to reload the triggers afterwards.

Note that this would only work in Java.

Example code:

// Supply user-friendly titles for the trigger values (optional)
LocalizationHelper localizationHelper = new LocalizationHelper();
// productValuesAndLabels is a HashMap<String, String> of values and their titles
localizationHelper.addTriggerTypeLabels("ProductType", productValuesAndLabels);

// Add or update the actual trigger
TriggerTypesHelper triggerTypesHelper = new TriggerTypesHelper();
TriggerType triggerType = triggerTypesHelper.createTriggerType("ProductType", "text", "my_product_type", triggerValues);

boolean success = triggerTypesHelper.addTriggerType(triggerType);
  1. Yes, you'll need to write a cartridge that provides the correct values for your triggers -- otherwise the Promotions based on them will never trigger.
  2. You never need to (nor are you supposed to) make any changes to the SmartTarget cartridge.
  3. We only document how to add triggers manually, but that is also quite useful to understand the process. See the following section of the documentation: Implementing Triggers.
  • In your own Java application that references the smarttarget_core.jar file. – Peter Kjaer Feb 10 '15 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.