Thursday, 14 November 2013

How to display products and skus in ATG, How to add a Sku to cart, How to display Sku images

After Creating New ATG MODULE,( Refer Previous Post Here)




Use the Following Out Of the BOX Atg droplets to display. Code Snippet is as shown bellow:

   

<%@ taglib uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_0" prefix="dsp" %>
<dsp:importbean bean="/atg/userprofiling/Profile" var="Profile"/>
<dsp:page>
<dsp:droplet name="/atg/dynamo/droplet/ForEach">

        <dsp:param name="array" bean="/atg/userprofiling/Profile.catalog.allRootCategories" />
          <dsp:param name="elementName" value="category" />
        <dsp:oparam name="output">
         <br/>

            <dsp:a href="categoryNavigation.jsp">

                <dsp:valueof param="category.displayName" />

                <dsp:param name="categoryId" param="category.id" />

            </dsp:a>

        </dsp:oparam>

    </dsp:droplet>

</dsp:page>


categoryNavigation.jsp:


 <%@ taglib uri="http://www.atg.com/taglibs/daf/dspjspTaglib1_0" prefix="dsp" %>
<dsp:page>
<dsp:droplet name="/atg/commerce/catalog/CategoryLookup">

        <dsp:param name="id" param="categoryId" />

        <dsp:param name="elementName" value="category" />

        <dsp:oparam name="output">
         <dsp:droplet name="/atg/dynamo/droplet/ForEach">

                <dsp:param name="array" param="category.childCategories" />

                <dsp:param name="elementName" value="category" />

                <dsp:oparam name="output">

                    <br />

                    <dsp:a href="categoryNavigation.jsp">

                        <dsp:valueof param="category.displayName" />

                        <dsp:param name="categoryId" param="category.id" />

                    </dsp:a>

                </dsp:oparam>

            </dsp:droplet>

            <dsp:droplet name="/atg/dynamo/droplet/ForEach">

                <dsp:param name="array" param="category.childProducts" />

                <dsp:param name="elementName" value="childProduct" />

                <dsp:oparam name="output">
<ul>
                    <br />
                        <dsp:valueof param="childProduct.id" />
                        <dsp:valueof param="childProduct.displayName" />
                        <dsp:valueof param="childProduct.childSKUs" />
                            <dsp:droplet name="/atg/dynamo/droplet/ForEach">
                                <dsp:param name="array" param="childProduct.childSKUs" />
                                <dsp:param name="elementName" value="childSKU" />
                                <dsp:oparam name="output">
                            <li>    <dsp:valueof param="childSKU.id" />
                        <dsp:valueof param="childSKU.displayName" />
                        <dsp:valueof param="childSKU.listPrice" />
                        <img src='/walletshop<dsp:valueof param="childSKU.largeImage.url"/>'/>
                        <dsp:form id="addSku" action="categoryNavigation.jsp">
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemCount" value="1" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemToOrderSuccessURL" value="/walletshop/catagrydisplay.jsp" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemToOrderErrorURL" value="/walletshop/errors.jsp" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.items[0].productId" paramvalue="childProduct.id" type="hidden"/>
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.items[0].quantity" type="hidden" value="1" />
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.items[0].catalogRefId" paramvalue="childSKU.id" type="hidden" />
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.pageFlow" value="true" type="hidden" />
                        <dsp:input bean="/atg/commerce/order/purchase/CartModifierFormHandler.addItemToOrder" value="add" type="hidden"/>      
                        <input type="submit"  value="Submit"/>
                        </dsp:form>
                      
                      
                      
                        </li>
                                </dsp:oparam>
                            </dsp:droplet>
</ul>
                </dsp:oparam>

            </dsp:droplet>



</dsp:oparam>

</dsp:droplet>
</dsp:page>



THE FORM IN THE categoryNavigation.jsp  IS TO ADD ITEM TO CART.




1 comments:

Anonymous said...

can you give after add to cart (cart.jsp)

Post a Comment

 
;