SiteGenesis Promotions

The Salesforce B2C Commerce promotion feature is implemented in the SiteGenesis application as follows:

Element Files Comments
Pipeline

Cart.xml

Processes the cart, which shows promotions along with any prices. The Cart-Calculate subpipeline calls the cart/CalculateCart.ds script before returning to the calling subpipeline.
  COShipping.xml Processes customer shipping details. Uses checkout/shipping/singleshipping to check for shipping promotions. Calls checkout/shipping/shippingmethodsjson for the shipping method.
  COShipping-RequiresMultiShipping.xml Handles shipping orders to multiple locations with multiple shipping methods. Uses checkout/shipping/multishippingshipments to check for shipping promotions.
  Product.xml Processes the product details and shows them on the storefront. It uses product/product.isml, which includes promotions in the generated information.
Script

cart/CalculateCart.ds

Implements a typical shopping cart calculation algorithm. You can customize this code to meet your specific needs and requirements. This script does the following:

  1. Determine the prices of products contained in the cart.
  2. Determine the shipping cost for the shipments of the cart.
  3. Determine the tax rates of all line items of the cart.
  4. Determines and applies all types of promotions.
  5. Calculates the totals of shipments as well as the cart.
  cart/CheckForNewBonusDiscountLineItem.ds See SiteGenesis Choice of Bonus Product Implementation.
  cart/GetBonusDiscountLineItem.ds See SiteGenesis Choice of Bonus Product Implementation.
  cart/ParseBonusProductsJSON.ds See SiteGenesis Choice of Bonus Product Implementation.
  cart/RemoveBonusDiscountLineItemProducts.ds See SiteGenesis Choice of Bonus Product Implementation.
  cart/ValidateCartForCheckout.ds

Implements a typical shopping cart checkout validation against specific conditions:

  • If the total price is not N/A
  • If products are still in site catalog and online
  • Product availability

This script validates product availability for all products.

Templates

checkout/billing/billing.isml

Shows the bonus product alert on the Billing page.
  checkout/cart/bonusdiscountlineitems.isml Shows the select bonus product message.
  checkout/cart/cart.isml Embeds promotions on the cart page within the price column.
  checkout/cart/minicart.isml Shows the bonus product alert.
  checkout/summary/summary.isml Shows bonus items and coupons in the summary.
  checkout/shipping/multishipping/multishippingshipments.isml Visualizes the second step of the multi shipping checkout scenario. It renders a list of all shipments (created by distinct shipping addresses) and provides a shipping method selection per shipment. It shows all applicable shipping promotions.
  checkout/shipping/singleshipping.isml Visualizes the second step of the single shipping checkout scenario. It renders a list of all shipments (created by distinct shipping addresses) and provides a shipping method selection per shipment.
  components/order/orderdetails.isml Implements the isorderdetails custom tag. Renders the order details. If it's a bonus product, renders the word Bonus.
  components/order/orderdetailsemail.isml Implements the isorderdetailsemail custom tag. Renders the order details in the email. If it's a bonus product, renders the word Bonus.
  product/components/bonusproduct.isml Is the rendering template for a bonus product.
  product/bonusproductgrid/bonusproductgrid.isml Is the main template that shows all bonus products used in the bonus product window.
  product/components/ subbonusproduct/subbonusproduct.isml Renders any subproduct of a bundle or product set. Used in the product/components/bonusproduct.isml template.
  product/bonusproductjson.isml Renders a bonus discount line item in JSON format. Not used in any template.
  util/reporting/ReportOrder.isml Logs price adjustment line items in report.
Resource files

checkout.properties

 
  product.properties  
  locale.properties  
CSS style.css Contains promotion-related style definitions (static/default/css) for bonus products lists and bonus line items.

Related Links

See the SiteGenesis Wireframes and Functional Specifications for additional details.

SiteGenesis Choice-of-Bonus-Product Implementation

SiteGenesis Application with Source Codes

See the B2C Commerce API documentation.