The Pioneer Cycling site uses two code fragments to display prices on the product template pages. These fragments can be found in the following directories:

List Price versus User’s Price

In the Pioneer Cycling store, we made a distinction between the list price for a product and the user’s price:

For example, on Mother’s Day the Pioneer Cycling store offers all women 20% off. The list price of a helmet is $100; the user’s price (for women) would be $80. The store also offers 50% off the price of a helmet with the purchase of a bike. However, the user’s price displayed on the product template page does not show this 50% discount, even if she is purchasing a bike. This order-level discount is displayed on the Shopping Cart page. Order-level discounts and promotions are calculated with the pricing calculators and are discussed in the Promotions section of the Merchandising chapter.

SKU Price

The DisplaySkuPrice.jsp code fragment displays the price of a single SKU. The code fragment below only addresses US currency. Code for different locales and currencies is addressed later in the manual.

<DECLAREPARAM NAME="Sku"
       CLASS="java.lang.Object"
       DESCRIPTION="A Sku repository Item - REQUIRED">

<dsp:importbean bean="/atg/commerce/pricing/PriceItem"/>
<dsp:importbean bean="/atg/dynamo/droplet/Compare"/>

<%/* The PriceItem droplet will fetch SKU
    * Price Info for this user. Any general
    * promotions this user is eligible for WILL
    * be reflected in the price. Any order
    * dependent promotions (ie buy one x, get
    * y 50% off) will NOT be reflected in the
    * price info returned by this droplet. */%>
<dsp:droplet name="/atg/commerce/pricing/PriceItem">
 <dsp:param name="item" param="Sku"/>
 <dsp:param name="elementName" value="PricedSku"/>

 <dsp:oparam name="output">
  <dsp:droplet name="/atg/dynamo/droplet/Compare">
   <dsp:param name="obj1" param="PricedSku.priceInfo.ListPrice"/>
   <dsp:param name="obj2" param="PricedSku.priceInfo.amount"/>

   <%/*ListPrice is greater, so display it first in strikout mode: */%>
   <dsp:oparam name="greaterthan">
    <span class="strikeout">
     <dsp:valueof converter="currency"
          param="PricedSku.priceInfo.ListPrice"/>
    </span>
   </dsp:oparam>
  </dsp:droplet>

  <%/*Display their price: */%>
  <dsp:valueof converter="currency" param="PricedSku.priceInfo.amount"/>
 </dsp:oparam>
</dsp:droplet> <%/*PriceItem droplet*/%>

We used the ATG Consumer Commerce PriceItem servlet bean to calculate the price for this SKU for this user. It is passed the SKU that needs to be priced, <dsp:param name="item" value="Sku"/>, and it passes back the SKU in a parameter called PricedSku with user-specific prices filled into it (<dsp:param name="elementName" value="PricedSku"/>).

The Compare servlet compares the product’s list price to the customer’s price. If the ListPrice is higher, it is displayed first, but with a “strike-out” font so the customer can see the discount she is getting. The user’s price is always displayed.

Inside PriceItem, the list price is displayed like this:

<dsp:valueof converter="currency" param="PricedSku.priceInfo.ListPrice"/>

The user’s price is displayed like this:

<dsp:valueof converter="currency" param="PricedSku.priceInfo.amount"/>

This is the call to the DisplaySkuPrice code fragment:

<dsp:include page="../../common/DisplaySkuPrice.jsp" flush="true">
     <dsp:param name="Sku" param="Sku"/>
</dsp:include>
Displaying Product Price

We used the DisplayProductPrice.jsp code fragment to display the price of a product versus the price of an individual SKU. It simply fetches the first SKU on the product and calls its DisplaySkuPrice.jsp code fragment. If your site has products with differently priced SKUs, you need to expand this functionality.

 
loading table of contents...