Integrating with a Third-Party Ordering System Based on Shopping Parameters
PTC Arbortext Content Delivery provides a framework to enable integration with a third-party system. This framework provides inputs related to the price and availability attributes of any order. The values for these attributes vary from user to user based on the shopping parameters and values provided. For example, if the user is shopping on behalf of a dealership's customer, the identity of that customer can influence the part price or might provide the customer a discount. The location can influence the availability. The user must provide such information to PTC Arbortext Content Delivery before the price and availability attributes are reflected in the system. This can impact the order processing as well. Using this customization point, the customer can ensure that each end-user gets the appropriate price and availability information based on the shopping parameters values. This information is immediately reflected in PTC Arbortext Content Delivery.
Integrating Shopping Parameters with the Third-Party Ordering System
When a shopping cart is ordered, if any of the internal names of shopping parameters match the internal names of the soft attributes on the SCEOrder object, the system saves them. This order object is available in the placeOrder() interface for further order processing. An API, get getShoppingParameters() on the com.ptc.sc.services.plugins.CommerceDelegate interface is available to provide the custom implementation for defining the shopping parameters.
Follow these steps to integrate the shopping parameters with the third-party ordering system:
1. Define the shopping parameters using soft attributes. Consider an example where you want to create the following shopping parameters:
Dealer Code
Customer
Store Location
For more information about creating soft attributes for shopping parameters, see Soft Attributes for Shopping Parameters.
2. Define the soft attributes for orders with the same internal names as that of the custom shopping parameters. For more information about creating soft attributes for orders, see Soft Attributes for Orders.
3. Use a custom delegate that implements the com.ptc.sc.services.plugins.CommerceDelegate interface to include the logic to get the key and value of soft attributes for orders. The keys and corresponding values can be passed to a third-party ordering system for further processing of orders. For more information about using a custom delegate for integrating PTC Arbortext Content Delivery with an ordering system, see Integrating PTC Arbortext Content Delivery with a Third-Party Ordering System. The Set Shopping Parameter action is available in the hamburger menu to set the shopping parameter values. This action is available only when the commerce delegate has any shopping parameters defined:
4. From the Set Shopping Parameters window, set the shopping parameters for the duration of the page session:
The shopping parameters are retrieved from the session storage and displayed in the header of PTC Arbortext Content Delivery user interface.
@Override
public SCFieldList getShoppingParameters(String requestedParamName, String forParamName, String forParamValue) {
SCFieldList resultList = new SCFieldList();
//Dealer code field
SCField dealerCode = new SCField("Dealer Code", "input", "", "dealerCode", null);
//Add to the resultList
resultList.addItem(dealerCode);

//Customer field
Map<String,String> customerValuesMap = new HashMap<String,String>();
customerValuesMap.put("customer1","Star Logistics");
customerValuesMap.put("customer2","PowerPlus Industries");
customerValuesMap.put("customer3","Spencer Construction");

SCField customerField = new SCField("Customer", "combo", null, "customer", customerValuesMap);
//Add to the resultList

resultList.addItem(customerField);


//Store location field for StarLogic
//Add StarLogic locations
Map<String, String> valuesMap = new HashMap<String, String>();
valuesMap.put("location1", "Minneapolis");
valuesMap.put("location2","Stillwater");
valuesMap.put("location3","Eagan");
SCField starLocationField = new SCField("Store Location", "combo", null, "location", valuesMap);
starLocationField.setForField("Star Logistics");

//Add to the resultList
resultList.addItem(starLocationField);


//Store location field for StarLogic
//Add Power Plus locations
Map<String, String> powerPlusLocations = new HashMap<String, String>();
powerPlusLocations.put("location1", "Edina");
powerPlusLocations.put("location2","Blaine");
powerPlusLocations.put("location3","Forest Lake");
SCField powerPlusFieldLocation = new SCField("Store Location", "combo", null, "location", powerPlusLocations);
powerPlusFieldLocation.setForField("PowerPlus Industries");

//Add to the resultList
resultList.addItem(powerPlusFieldLocation);

//Store location field for StarLogic
//Add Spencer locations
Map<String, String> spencerLocations = new HashMap<String, String>();
spencerLocations.put("location1", "Minnetonka");
spencerLocations.put("location2","Eagan");
spencerLocations.put("location3","Bloomington");
SCField spencerLocationField = new SCField("Store Location", "combo", null, "location", spencerLocations);
spencerLocationField.setForField("Spencer Construction");

//Add to the resultList
resultList.addItem(spencerLocationField);
return resultList;

}