Integrating Shopping Parameters with a Third-Party Pricing System
PTC Arbortext Content Delivery enables you to integrate the shopping parameters with a third-party pricing system. To integrate the parameters, you use a custom delegate that implements the com.ptc.sc.services.plugins.PricingDelgate interface. The interface must call the getItemUnitPrice(SCItem item) and getAvailablity(double price) methods.
You can make available the following information in the custom delegate:
The part number from PTC Arbortext Content Delivery to the third-party pricing system.
The values for shopping parameters from PTC Arbortext Content Delivery to the third-party pricing system when determining the price and availability of part items.
The unit price and availability of the part item from the third-party pricing system to PTC Arbortext Content Delivery based on the values for shopping parameters.
Example Code for Obtaining the Unit Price of a Part Item from a Third-Party Pricing System
The following example code in the getItemUnitPrice(SCItem item) method of the custom delegate uses the value of the shopping parameter customer and the part number in PTC Arbortext Content Delivery to get the unit price of the part item from a third-party pricing system:
if (partNumber != null) {
// Use shopping parameters if they exist
SCFieldList shoppingParams = SCRequestContextUtility.getShoppingParameters();
if (shoppingParams != null && shoppingParams.getTotalAvailable() > 0) {
// If pricing parameters are set generate price based on the customer selected
for (int i=0; i < shoppingParams.getItems().size(); i++) {
SCField currentParam = shoppingParams.getItems().get(i);
if (currentParam.getInternalName().equalsIgnoreCase("customer")) {
//$10 for Star Logistics, $15 for PowerPlus Industries, $20 for Spencer Construction
if (currentParam.getValue().equalsIgnoreCase("Star Logistics")) {
unitPrice = STAR_LOGISTICS_PRICE;
} else if (currentParam.getValue().equalsIgnoreCase("PowerPlus Industries")){
unitPrice = POWER_PLUS_PRICE;
} else if (currentParam.getValue().equalsIgnoreCase("Spencer Construction")){
unitPrice = SPENCER_PRICE;
}
}
}
Example Code for Obtaining the Availability of a Part Item from a Third-Party Pricing System
The following example code in the getAvailablity(double price) method of the custom delegate uses the value of the shopping parameter location and the part number in PTC Arbortext Content Delivery to get the availability of the part item from a third-party pricing system:
// Use shopping parameters if they exist
SCFieldList shoppingParams = SCRequestContextUtility.getShoppingParameters();
SCQueryInfo queryInfo = SCRequestContextUtility.getSCQueryInfo();
if (shoppingParams != null && shoppingParams.getTotalAvailable() > 0) {
// If pricing parameters are set generate availability based on the location selected
for (int i = 0; i < shoppingParams.getItems().size(); i++) {
SCField currentParam = shoppingParams.getItems().get(i);
if (currentParam.getInternalName().equalsIgnoreCase("location")) {
// 5 for Minneapolis, 3 for Eagan, 2 for Blaine
if (currentParam.getValue().equalsIgnoreCase("Minneapolis")) {
availability = MINNEAPOLIS_AVAILABILITY;
} else if (currentParam.getValue().equalsIgnoreCase("Eagan")) {
availability = EAGAN_AVAILABILITY;
} else if (currentParam.getValue().equalsIgnoreCase("Blaine")) {
availability = BLAINE_AVAILABILITY;
} else {
// "Back Ordered" (localized message) for the other locations.
availability = SCEResourceBundleUtility.getLocalizedMessage(SCDemoDelegateRB.class.getName(), "PART_BACK_ORDERED", queryInfo);
}
}
}

}