Monday, 7 March 2016

Sample Program for ATG Wishlist, Giftlist

Sample program to display wishlist items

<dsp:page>
	<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
	<dsp:importbean bean="/atg/userprofiling/Profile"/>
	<dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
	<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
	<dsp:importbean bean="/atg/dynamo/droplet/IsEmpty"/>

	<b> <center>My Favourites Listing</center></b>
	<br>
	<dsp:valueof param="Profile"/>
	<dsp:setvalue beanvalue="Profile.wishlist" param="wishlist"/>
	<dsp:setvalue paramvalue="wishlist.giftlistItems" param="items"/>
	<dsp:setvalue paramvalue="wishlist.id" param="wishlistId"/>
	<table cellspacing=2 cellpadding=1 border=1 width=75%>
    
		      <tr>
		      	<td colspan=8>My Favourites</td>
		      </tr>
		      <tr>
		        <dsp:droplet name="IsEmpty">
					  <dsp:param name="value" param="items"/>
					  <dsp:oparam name="false">
					    		<dsp:droplet name="/atg/dynamo/droplet/ForEach">
					      				<dsp:param name="array" param="items"/>
					      				<dsp:oparam name="output">
					        			<tr valign=top>
					        			<td>
											<dsp:valueof param="element"/>
											Quantity:  <dsp:valueof param="element.quantityDesired"/>
										</td>
					        			<td></td>
       									<td>
										<dsp:droplet name="/atg/commerce/catalog/ProductLookup">
								            <dsp:param name="id" param="element.productId"/>
								            <dsp:param name="elementName" value="product"/>
								            <dsp:oparam name="output">
								              <b>
								              <dsp:droplet name="/atg/commerce/catalog/SKULookup">
										              <dsp:param name="id" param="element.catalogRefId"/>
										              <dsp:param name="elementName" value="giftSku"/>
										              <dsp:oparam name="output">
										              	  item Name: <dsp:valueof param="giftSku.displayName"/>
										              	  <br>
													   </dsp:oparam>
								                </dsp:droplet>
								                </b>
								            </dsp:oparam>
								          </dsp:droplet>
								        </td>
								        <td></td>
							</dsp:oparam>
						</dsp:droplet>
					</dsp:oparam>
				</dsp:droplet>
			</tr>
		</table>
</dsp:page>	  



Sample program to display giftlists


<dsp:page>
	<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
	<dsp:importbean bean="/atg/userprofiling/Profile"/>
	<dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
	<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
	<dsp:importbean bean="/atg/dynamo/droplet/IsEmpty"/>
	<dsp:importbean bean="/atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet"/>
	<b> <center>Display List of Registry present in user profile.</center></b>
	<br>
	<dsp:droplet name="GiftlistSiteFilterDroplet">
        <dsp:param name="collection"  bean="/atg/userprofiling/Profile.giftlists"/>
        <dsp:oparam name="output">
          <dsp:getvalueof var="giftlists" param="filteredCollection" />
  				<c:forEach var="giftlist" items="${giftlists}" varStatus="giftlistStatus">
		              <dsp:getvalueof var="count" idtype="int" value="${giftlistStatus.count}"/>
		              <dsp:getvalueof var="index" idtype="int" value="${giftlistStatus.index}"/>
		              <dsp:param name="giftlist" value="${giftlist}"/>
  					  <dsp:getvalueof var="eventName" vartype="java.lang.String" param="giftlist.eventName"/>
                		<br>
                		eventName: <c:out value="${eventName}"/>
                		<br>
                		<br/>
                		Owner : <dsp:valueof value="${giftlist.owner.id}"/></br/>
						<dsp:getvalueof var="eventType" param="giftlist.eventType"/>
      				  <br>
                		eventType: <c:out value="${eventType}"/>
						Event Description:
                		<dsp:getvalueof var="description" param="giftlist.description"/>
      				 	<c:out value="${description}"/>
      				 	<br>
      				 	special instructions And Venue Details:
      				 	<dsp:getvalueof var="instructions" param="giftlist.instructions"/>
      				 	<c:out value="${instructions}"/>
      				 	<br>
      				 	Comments:
      				 	<dsp:getvalueof var="comments" param="giftlist.comments"/>
      				 	<c:out value="${comments}"/>
      				 	<br>
      				 	Shipping Address Associated:<br>
      				 	<dsp:valueof param="giftlist.owner.firstName"/>
      				 	<dsp:valueof param="giftlist.owner.lastName"/>
      				 	<dsp:valueof param="giftlist.shippingAddress.firstName"/>
					    <dsp:valueof param="giftlist.shippingAddress.middleName"/>
					    <dsp:valueof param="giftlist.shippingAddress.lastName"/><br>
					    <dsp:valueof param="giftlist.shippingAddress.city"/>,
					    <dsp:valueof param="giftlist.shippingAddress.state"/><br>
      				 	<br>
						 List of items in the Registry are:
	                  <dsp:droplet name="/atg/dynamo/droplet/ForEach">
						     <dsp:param name="array" param="giftlist.giftlistItems"/>
						     <dsp:oparam name="output">
						      <dsp:setvalue paramvalue="element" param="item"/>
						      <dsp:getvalueof param="item.id" var="itemId"/>
						      gitemId:<c:out value="${itemId}"/>
							  <<<Using product look up droplet print the element details as shown in wishlist example>>>
							  </dsp:oparam>
					    </dsp:droplet>
					    <br>
					    
					    <br>
				</c:forEach>
				<dsp:oparam name="empty">
					There are no gift lists to display.
				</dsp:oparam>
      </dsp:droplet>
</dsp:page>


Sample program to remove item from giftlist/wishlist:
<dsp:page>
<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
<dsp:form id="f1" method="POST" action="">
	<dsp:getvalueof var="giftlistId" param="giftListId"></dsp:getvalueof>
	<dsp:getvalueof var="giftId" param="giftId"></dsp:getvalueof>

	  <dsp:droplet name="/atg/commerce/gifts/RemoveItemFromGiftlist">
		<dsp:param name="giftlistId" param="giftListId"/>
		<dsp:param name="giftId" value="${giftId}"/>
		<dsp:oparam name="error">
		  <font color=cc0000><STRONG><UL>
		  <li>Either giftlist not found or you are not the owner.
		  </UL></STRONG></font>
		</dsp:oparam>
		<dsp:oparam name="output">
		<font color=cc0000><STRONG><UL>
		  <li>Gift List Item Successfully removed.
		  </UL></STRONG></font>
		  <dsp:include page="myFavouritesHome.jsp" />
		  
		</dsp:oparam>
	  </dsp:droplet>

	<dsp:input bean="GiftlistFormHandler.giftlistId" paramvalue="giftlistId" type="hidden"/>
</dsp:form>
</dsp:page>



Sample program to add item to wishlist/ giftlist:


<dsp:form action="addItemtoMyFav.jsp" method="post" id="glform">
	<input name="id" type="hidden" value='<dsp:valueof param="id"/>'/>
	<input type="hidden" name="itemType" value="product"/>
	<input name="itemId" type="hidden" value="prod10001"/>
	<dsp:input bean="GiftlistFormHandler.productId" value="prod10001" type="hidden"/>
	quantity <dsp:input bean="GiftlistFormHandler.quantity" size="4" type="text" value="1"/>
	<dsp:input bean="GiftlistFormHandler.catalogRefIds" value="sku10001" type="hidden"/>
	<dsp:setvalue beanvalue="Profile.wishlist" param="wishlist"/>
	<dsp:setvalue paramvalue="wishlist.id" param="wishlistId"/>
	<dsp:valueof param="wishlistId"/>
	<c:set var="wishlistId"><dsp:valueof param="wishlistId"/></c:set>
	<dsp:input type="hidden" bean="GiftlistFormHandler.giftlistId" value="${wishlistId}"></dsp:input>
	<dsp:input bean="GiftlistFormHandler.addItemToGiftlistErrorURL" type="hidden" value="addItemtoMyFav.jsp"/>
	<dsp:input bean="GiftlistFormHandler.addItemToGiftlistSuccessURL" type="hidden" value="myFavouritesHome.jsp"/>							
	<dsp:input bean="GiftlistFormHandler.addItemToGiftlist" type="submit" value="Add to Fav"/>	
</dsp:form>	



Sample program to create Giftlist:

<dsp:page>
<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
<dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
<dsp:importbean bean="/atg/dynamo/droplet/IsEmpty"/>
<dsp:importbean bean="/atg/userprofiling/Profile"/>
<%--
	Deal with error messages here by including error page here
 --%>
 <dsp:include page="giftListErrors.jsp" />

<span class=storebig>Create new Registry</span>
<dsp:form action="giftListHome.jsp" method="POST">
<b>Event Name</b><br>
<dsp:setvalue bean="GiftlistFormHandler.eventName" value=""/>
  <dsp:input bean="GiftlistFormHandler.eventName" size="40" type="text"/>
  <p>
  <b>Event Date</b>
  <dsp:select bean="GiftlistFormHandler.month">
    <dsp:droplet name="ForEach">
      <dsp:param bean="GiftlistFormHandler.months" name="array"/>
      <dsp:oparam name="output">
        <dsp:getvalueof id="option564" param="index"
             idtype="java.lang.Integer">
          <dsp:option value="<%=option564%>"><dsp:valueof param="element">UNDEFINED</dsp:valueof></dsp:option>
      </dsp:getvalueof>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:select>
  <dsp:select bean="GiftlistFormHandler.date">
  <dsp:droplet name="ForEach">
    <dsp:param bean="GiftlistFormHandler.dates" name="array"/>
    <dsp:oparam name="output">
      <dsp:option paramvalue="element">
       <dsp:valueof param="element">UNDEFINED</dsp:valueof>
       </dsp:option>
    </dsp:oparam>
  </dsp:droplet>
  </dsp:select>
  <dsp:select bean="GiftlistFormHandler.year">
  <dsp:droplet name="ForEach">
    <dsp:param bean="GiftlistFormHandler.years" name="array"/>
    <dsp:oparam name="output">
      <dsp:option paramvalue="element">
       <dsp:valueof param="element">UNDEFINED</dsp:valueof>
       </dsp:option>
    </dsp:oparam>
    </dsp:droplet>
    </dsp:select>
   <p>
   <b>Event Type</b>
   <dsp:select bean="GiftlistFormHandler.eventType">
   <dsp:droplet name="ForEach">
     <dsp:param bean="GiftlistFormHandler.eventTypes" name="array"/>
     <dsp:oparam name="output">
       <dsp:option paramvalue="element">
       <dsp:valueof param="element">UNDEFINED</dsp:valueof>
       </dsp:option>
     </dsp:oparam>
     </dsp:droplet>
     </dsp:select><br>
<br>
  <b>Event Description</b><br>
  <dsp:setvalue bean="GiftlistFormHandler.description" value=""/>
<%--  <dsp:textarea bean="GiftlistFormHandler.description" maxlength="254"
                    value="" rows="4" cols="40"></dsp:textarea> --%>
  <dsp:textarea bean="GiftlistFormHandler.description" rows="4"
       cols="40"></dsp:textarea>
  <p>
  <b>special instructions And Venue Details</b><br>
  <%-- <dsp:textarea bean="GiftlistFormHandler.instructions"
        maxlength="254" value="" rows="4" cols="40"></dsp:textarea> --%>
        <dsp:setvalue bean="GiftlistFormHandler.instructions" value=""/>
  <dsp:textarea bean="GiftlistFormHandler.instructions" rows="4"
       cols="40"></dsp:textarea>
  <p>
  <br>
    <b>Comments</b><br>
  <dsp:setvalue bean="GiftlistFormHandler.comments" value=""/>
  <dsp:textarea bean="GiftlistFormHandler.comments" rows="4"
       cols="40"></dsp:textarea>
<%--  <dsp:textarea bean="GiftlistFormHandler.comments" maxlength="254"
       value="" rows="4" cols="40"></dsp:textarea></dsp:textarea> --%>
  <p>
  <b>Where should people ship the gifts?</b><p>
  <blockquote>
  <dsp:input bean="GiftlistFormHandler.isNewAddress" type="radio"
       checked="<%=true%>" value="false"/>Choose one of your saved
       shipping destinations.<br>
    <dsp:select bean="GiftlistFormHandler.shippingAddressId">
    <dsp:droplet name="ForEach">
      <dsp:param bean="GiftlistFormHandler.addresses" name="array"/>
      <dsp:oparam name="output">
        <dsp:getvalueof id="option695" param="key"
             idtype="java.lang.String">
          <dsp:option value="<%=option695%>"><dsp:valueof param="element">UNDEFINED</dsp:valueof></dsp:option>
        </dsp:getvalueof>
      </dsp:oparam>
    </dsp:droplet>
    </dsp:select><br>
  <p>
  <dsp:input bean="GiftlistFormHandler.isNewAddress" type="radio"
       value="true"/>New address below
  <p>
  If you want this address stored in your address book, please give it a
  nickname:<br>
  <dsp:input bean="GiftlistFormHandler.newAddressName" size="40"/><br>
  Name <br><dsp:input bean="GiftlistFormHandler.newAddress.firstName"
            name="firstName" size="15"/>
  <dsp:input bean="GiftlistFormHandler.newAddress.middleName"
       name="middleName" size="5"/>
  <dsp:input bean="GiftlistFormHandler.newAddress.lastName"
       name="lastName" size="15"/><br>
  Street address <br>
  <dsp:input bean="GiftlistFormHandler.newAddress.address1"
       name="address1" size="40"/><br>
  <dsp:input bean="GiftlistFormHandler.newAddress.address2"
       name="address2" size="40"/><br>
  <table border=0 cellspacing=0 cellpadding=0>
    <tr valign=top>
      <td>City<br>
      <dsp:input bean="GiftlistFormHandler.newAddress.city" name="city"
           size="15"/></td>
      <td>State<br>
     <dsp:input  bean="GiftlistFormHandler.newAddress.state" name="state" size="15"/>
      </td>
     <td>Postal Code<br>
     <dsp:input bean="GiftlistFormHandler.newAddress.postalCode"
          name="postalCode" size="15"/></td>
    </tr>
  </table>

     Country
            <dsp:input bean="GiftlistFormHandler.newAddress.country" name="country" size="15"/>
           
  </blockquote>

  <p>&nbsp;<br>
  </td>
  </tr>

  <tr valign=top>
  <td width=30%>
  <span class=help>
  Decide if you want your list to be public yet. When you make your list
  public, your friends can
  find your list by searching.
  </span>

  </td>
  <td></td>
  <td>
  <table width=100% cellpadding=0 cellspacing=0 border=0>
  <tr><td class=box-top-store>Gift list public?</td></tr></table>
  <p>

  <dsp:input bean="GiftlistFormHandler.isPublished" name="published"
       type="radio" value="true"/> Make my list public now<br>
  <dsp:input bean="GiftlistFormHandler.isPublished" name="published"
       type="radio" checked="<%=true%>" value="false"/> Don't make my list
       public yet

  <p>&nbsp;<br>
<dsp:input bean="GiftlistFormHandler.type" value="GIFTLIST" type="hidden"/>  
<dsp:input bean="GiftlistFormHandler.saveGiftlist" value="Create and Save giftlist" type="submit"/>
       </p>
       </td>
       </tr>
       </p>
       </dsp:form>
       </dsp:page>
       




0 comments:

Post a Comment

 
;