Class Name

atg.commerce.pricing.UnitPriceDetailDroplet

Component(s)

/atg/commerce/pricing/UnitPriceDetailDroplet

The UnitPriceDetailDroplet can provide detailed price information for units in a given line item or groups, along with discount information. This is useful for displaying information such as “3 @ $2.00” or “2 @ $10.00, 1 @ $0.00 (Buy 2 Get 1 Free)”.

Input Parameters

item
The line item for which you want to display details. When you use this parameter, the appropriate servlet beans are requested. Note that the item parameter will not display any group information, even if you use the requestedBeans parameter.

order
The order for which price servlet beans are requested. When working with group discounts, commerce items can be split across multiple groups. As such, servlet beans are generated for an order, as opposed to a commerce item. If you pass in an order, you must pass in the requestedBeans.

requestedBeans
Identifies which servlet bean to request. This parameter is used with the order parameter. If you pass in an item parameter, you do not need to specify a servlet bean to request. Variables include:

Note: If you use pass in all three input parameters, the item parameter will be ignored, and price information will be returned based upon the order and requestedBeans parameters.

Output Parameters

UnitPriceBeans
The droplet output is a list of UnitPriceBean objects ordered by commerce item and group.

Open Parameters

output
The open parameter is always rendered.

Example

The following example shows a portion of a JSP that uses the UnitPriceDetailDroplet servlet bean to display detailed information about line items in an order.

<dsp:droplet name="UnitPriceDetailDroplet">
  <dsp:param name="item" param="currentItem"/>
  <dsp:oparam name="output">

    <dsp:getvalueof var="unitPriceBeans" vartype="java.lang.Object"
        param="unitPriceBeans"/>
      <c:forEach var="unitPriceBean" items="${unitPriceBeans}">

        <dsp:param name="unitPriceBean" value="${unitPriceBean}"/>
        <dsp:getvalueof var="quantity" vartype="java.lang.Double"
            param="unitPriceBean.quantity"/>
          <p class="price">
            <fmt:formatNumber value="${quantity}" type="number"/>
            <fmt:message key="common.atRateOf"/>
            <dsp:getvalueof var="unitPrice" vartype="java.lang.Double"
                param="unitPriceBean.unitPrice"/>
            <fmt:formatNumber value="${unitPrice}" type="currency"
                currencyCode="${currencyCode}"/>
          </p>

        <dsp:getvalueof var="pricingModels" vartype="java.lang.Object"
            param="unitPriceBean.pricingModels"/>
          <c:choose>
            <c:when test="${not empty pricingModels}">
              <c:forEach var="pricingModel" items="${pricingModels}">
                <dsp:param name="pricingModel" value="${pricingModel}"/>
                  <p class="note">
                   (<dsp:valueof param="pricingModel.description">
                      <fmt:message key="common.promotionDescriptionDefault"/>
                    </dsp:valueof>)
                  </p>
              </c:forEach><%-- End for each promotion used to create the unit
                   price --%>
            </c:when>

            <c:otherwise>
              <dsp:getvalueof var="currentItemOnSale"
                  param="currentItem.priceInfo.onSale"/>
                <c:if test='${currentItemOnSale == "true"}'>
                  <p><fmt:message key="cart_detailedItemPrice.salePriceB"/></p>
                </c:if>
            </c:otherwise>
          </c:choose>
       </dsp:oparam>
     </dsp:droplet>
  <%-- Render each price bean in the shopping cart. We supply an order a
            request for all beans sorted by group (allByGroup). Currently the only
            other supported option is 'groupedOnly' which will skip any bean that
            isn't part of a group --%>
       <dsp:droplet name="UnitPriceDetailDroplet">
         <dsp:param name="requestedBeans" value="allByGroup" />
         <dsp:param name="order" bean="ShoppingCart.current" />
     </dsp:droplet>

Copyright © 1997, 2019 Oracle and/or its affiliates. All rights reserved. Legal Notices