Monday, 29 February 2016

Display Cart Contents in ATG

 First display errors if any as shown below:

<dsp:droplet name="Switch">
 <dsp:param bean="CartModifierFormHandler.formError" name="value"/>
 <dsp:oparam name="true">
  <UL>
   <dsp:droplet name="ErrorMessageForEach">
    <dsp:param bean="CartModifierFormHandler.formExceptions" name="exceptions"/>
    <dsp:oparam name="output">
     <LI>
     <dsp:valueof param="message"/>
    </dsp:oparam>
   </dsp:droplet>
  </UL>
 </dsp:oparam>
</dsp:droplet>


If there are any manipulations allowed on cart content, use the below code for pricing related changes to be replicated:

 <dsp:droplet name="RepriceOrderDroplet">
     <dsp:param name="pricingOp" value="ORDER_SUBTOTAL"/>
   </dsp:droplet>
     <dsp:droplet name="RepriceOrderDroplet">
     <dsp:param name="pricingOp" value="ORDER_TOTAL"/>
   </dsp:droplet> 

Display commerce Items in jsp as shown below:

<dsp:getvalueof var="commerceItemCount" bean="ShoppingCart.current.CommerceItemCount"/> 
<c:choose>
 <c:when test='${commerceItemCount < 1}'>
  No product is added to your cart. Please click on "Continue Shopping" button.
 </c:when>
 <c:otherwise>
  <dsp:droplet name="/atg/dynamo/droplet/ForEach">
   <dsp:param name="array" bean="ShoppingCart.current.commerceItems"/>
   <dsp:setvalue param="commerceItem" paramvalue="element" />
   <dsp:oparam name="output">
    SkuID:<dsp:valueof param="commerceItem.catalogRefId" />
    <c:set var="commerceItemId"><dsp:valueof param="commerceItem.id"/></c:set>
    <c:set var="commerceItemQuantity"><dsp:valueof param="commerceItem.quantity"/></c:set>
    Price:</b><br><dsp:valueof converter="currency" param="commerceItem.priceInfo.listPrice">no price</dsp:valueof>
    ToatalPrice:</b><br><dsp:valueof converter="currency" param="commerceItem.priceInfo.amount">no price</dsp:valueof>
   </dsp:oparam> 
  </dsp:droplet>
 </c:otherwise>
</c:choose>



0 comments:

Post a Comment

 
;