<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>betweenGo &#187; Commerce</title>
	<atom:link href="http://betweengo.com/category/atg/commerce/feed/" rel="self" type="application/rss+xml" />
	<link>http://betweengo.com</link>
	<description>We make Ruby on Rails easy.  We make ATG easy.</description>
	<lastBuildDate>Tue, 06 Dec 2011 14:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Adding a New Link to a Commerce Pipeline</title>
		<link>http://betweengo.com/2011/06/22/adding-a-new-link-to-a-commerce-pipeline/</link>
		<comments>http://betweengo.com/2011/06/22/adding-a-new-link-to-a-commerce-pipeline/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 21:22:06 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://betweengo.com/2011/06/22/adding-a-new-link-to-a-commerce-pipeline/</guid>
		<description><![CDATA[Only as strong as the weakest link. Part 2 by David&#8217;n'Sheila To add new links to a commerce pipeline you need to override the default definition for the appropriate commerce pipeline.&#160; Commerce pipelines are defined in XML so you use ATG’s XML combining feature to accomplish this. For example if you want to add a [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
<li><a href='http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/' rel='bookmark' title='Update Profile in ATG Commerce'>Update Profile in ATG Commerce</a></li>
<li><a href='http://betweengo.com/2010/01/12/combining-xml-in-atg/' rel='bookmark' title='Combining XML in ATG'>Combining XML in ATG</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/afferent/461165947/"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="Only as strong as the weakest link. Part 2 | Flickr" alt="Only as strong as the weakest link. Part 2 | Flickr" src="http://farm1.static.flickr.com/196/461165947_ae3cdcca07.jpg" /></a></p>
<p align="center"><a title="Only as strong as the weakest link. Part 2 | Flickr" href="http://www.flickr.com/photos/afferent/461165947/">Only as strong as the weakest link. Part 2</a> by <a title="Flickr: David&#39;n&#39;Sheila&#39;s Photostream" href="http://www.flickr.com/photos/afferent/">David&#8217;n'Sheila</a></p>
<p>To add new links to a commerce pipeline you need to override the default definition for the appropriate commerce pipeline.&#160; Commerce pipelines are defined in XML so you use <a title="Combining XML in ATG « betweenGo" href="http://betweengo.com/2010/01/12/combining-xml-in-atg/" target="_blank">ATG’s XML combining feature</a> to accomplish this.</p>
<p>For example if you want to add a new link to the ProcessOrder chain in the /atg/commerce/commercepipeline.xml you would create the following commercepipeline.xml in your local config.</p>
<pre>&lt;pipelinemanager&gt;
  &lt;pipelinechain name=&quot;processOrder&quot; xml-combine=&quot;append&quot;&gt;
    &lt;pipelinelink transaction=&quot;TX_MANDATORY&quot; name=&quot;authorizePayment&quot; xml-combine=&quot;replace&quot;&gt;
      &lt;processor jndi=&quot;/atg/commerce/order/processor/AuthorizePayment&quot; /&gt;
      &lt;transition returnvalue=&quot;1&quot; link=&quot;updateInventory&quot; /&gt;
    &lt;/pipelinelink&gt;
    &lt;pipelinelink name=&quot;updateInventory&quot; transaction=&quot;TX_MANDATORY&quot;&gt;
      &lt;processor jndi=&quot;/betweengo/commerce/inventory/processor/ProcUpdateInventory&quot; /&gt;
      &lt;transition returnvalue=&quot;1&quot; link=&quot;updateGiftRepository&quot; /&gt;
    &lt;/pipelinelink&gt;
&lt;/pipelinemanager&gt;</pre>
<p>In this example we added the new updateInventory link which is inserted between the authorizePayment and updateGiftRepository links.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2011%2F06%2F22%2Fadding-a-new-link-to-a-commerce-pipeline%2F&amp;title=Adding%20a%20New%20Link%20to%20a%20Commerce%20Pipeline" id="wpa2a_2"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
<li><a href='http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/' rel='bookmark' title='Update Profile in ATG Commerce'>Update Profile in ATG Commerce</a></li>
<li><a href='http://betweengo.com/2010/01/12/combining-xml-in-atg/' rel='bookmark' title='Combining XML in ATG'>Combining XML in ATG</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2011/06/22/adding-a-new-link-to-a-commerce-pipeline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Specifying the Calculator per Promotion</title>
		<link>http://betweengo.com/2011/03/07/specifying-the-calculator-per-promotion/</link>
		<comments>http://betweengo.com/2011/03/07/specifying-the-calculator-per-promotion/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 16:00:00 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>

		<guid isPermaLink="false">http://betweengo.com/2011/03/07/specifying-the-calculator-per-promotion/</guid>
		<description><![CDATA[(Photo: calculator by ansik) ATG’s documentation, as far as I can’t tell, does not document how to specify the calculator for a promotion.&#160; Promotion’s have a repository property called pricingCalculatorService.&#160; In the ACC you won’t see it by default but you will see it if you show expert-level information.&#160; Also you can see it configured [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2007/12/07/creating-buy-n-get-m-free-promotions/' rel='bookmark' title='Creating Buy N Get M Free Promotions'>Creating Buy N Get M Free Promotions</a></li>
<li><a href='http://betweengo.com/2009/12/15/nullpointerexception-in-atg-orderdiscountcalculator/' rel='bookmark' title='NullPointerException in ATG OrderDiscountCalculator'>NullPointerException in ATG OrderDiscountCalculator</a></li>
<li><a href='http://betweengo.com/2007/11/17/date-and-timestamp-repository-data-types/' rel='bookmark' title='Date and Timestamp Repository Data Types'>Date and Timestamp Repository Data Types</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flickr.com/photos/ansik/304526237/"><img title="calculator on Flickr" alt="calculator on Flickr" src="http://farm1.static.flickr.com/109/304526237_6d1acf58bb.jpg" /></a></p>
<p align="center">(Photo: <a title="calculator on Flickr" href="http://www.flickr.com/photos/ansik/304526237/">calculator</a> by <a title="Flickr: ansik&#39;s Photostream" href="http://www.flickr.com/photos/ansik/">ansik</a>)</p>
<p>ATG’s documentation, as far as I can’t tell, does not document how to specify the calculator for a promotion.&#160; Promotion’s have a repository property called <tt>pricingCalculatorService</tt>.&#160; In the ACC you won’t see it by default but you will see it if you <a title="Viewing Expert-Level Information in the ACC" href="http://betweengo.com/2007/12/06/viewing-expert-level-information-in-the-acc/">show expert-level information</a>.&#160; Also you can see it configured in the Promotion repository (<tt>/atg/commerce/pricing/Promotions</tt>).</p>
<p>Having a repository property for each promotion allows you to specify different calculators for different promotions.&#160; But typically you will probably specify the same one for the same class of promotion, e.g. <tt>/betweengo/commerce/pricing/calculators/ItemDiscountCalculator</tt>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2011%2F03%2F07%2Fspecifying-the-calculator-per-promotion%2F&amp;title=Specifying%20the%20Calculator%20per%20Promotion" id="wpa2a_4"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2007/12/07/creating-buy-n-get-m-free-promotions/' rel='bookmark' title='Creating Buy N Get M Free Promotions'>Creating Buy N Get M Free Promotions</a></li>
<li><a href='http://betweengo.com/2009/12/15/nullpointerexception-in-atg-orderdiscountcalculator/' rel='bookmark' title='NullPointerException in ATG OrderDiscountCalculator'>NullPointerException in ATG OrderDiscountCalculator</a></li>
<li><a href='http://betweengo.com/2007/11/17/date-and-timestamp-repository-data-types/' rel='bookmark' title='Date and Timestamp Repository Data Types'>Date and Timestamp Repository Data Types</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2011/03/07/specifying-the-calculator-per-promotion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load ATG Order</title>
		<link>http://betweengo.com/2010/11/14/load-atg-order/</link>
		<comments>http://betweengo.com/2010/11/14/load-atg-order/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 07:20:00 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://betweengo.com/2010/11/15/load-order/</guid>
		<description><![CDATA[Crystal Ball by David Reece You can always look up an order in the repository using it’s ID.&#160; But then you want to use the properties of this order object you will always be calling getPropertyValue and casting it to the type you expect. A better and much simpler way is to look up the [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2009/08/17/how-to-debug-an-invalidversionexception-from-updating-an-atg-order/' rel='bookmark' title='How to Debug an InvalidVersionException from Updating an ATG Order'>How to Debug an InvalidVersionException from Updating an ATG Order</a></li>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
<li><a href='http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/' rel='bookmark' title='Update Profile in ATG Commerce'>Update Profile in ATG Commerce</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flickr.com/photos/spursfan_ace/1162117754/"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="Crystal Ball | Flickr" alt="Crystal Ball | Flickr" src="http://farm2.static.flickr.com/1333/1162117754_e64afe710e.jpg" /></a><a title="Crystal Ball | Flickr" href="http://www.flickr.com/photos/spursfan_ace/1162117754/">Crystal Ball</a> by <a title="David Reece&#39;s Photostream | Flickr" href="http://www.flickr.com/photos/spursfan_ace/">David Reece</a></p>
<p>You can always look up an order in the repository using it’s ID.&#160; But then you want to use the properties of this order object you will always be calling <a title="RepositoryItem.getPropertyValue (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.0/apidoc/atg/repository/RepositoryItem.html#getPropertyValue%28java.lang.String%29">getPropertyValue</a> and casting it to the type you expect.</p>
<p>A better and much simpler way is to look up the order using the <a title="OrderManager (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.0/apidoc/atg/commerce/order/OrderManager.html">OrderManager</a>.&#160; Then you get a strongly typed <a title="Order (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.0/apidoc/atg/commerce/order/Order.html">Order</a> object and don’t have have to deal with the repository.&#160; Life has become a little easier. <img src='http://betweengo.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<pre>OrderManager orderManager = getOrderManager;
Order order = orderManager.loadOrder(orderId);</pre>
<p>
  <br />Now that you have the order you can also get the profile for that order.</p>
<p></p>
<pre>RepositoryItem profile = getProfileTools().getProfileForOrder(order);</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2010%2F11%2F14%2Fload-atg-order%2F&amp;title=Load%20ATG%20Order" id="wpa2a_6"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2009/08/17/how-to-debug-an-invalidversionexception-from-updating-an-atg-order/' rel='bookmark' title='How to Debug an InvalidVersionException from Updating an ATG Order'>How to Debug an InvalidVersionException from Updating an ATG Order</a></li>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
<li><a href='http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/' rel='bookmark' title='Update Profile in ATG Commerce'>Update Profile in ATG Commerce</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2010/11/14/load-atg-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limiting the Quantity Added to a Cart</title>
		<link>http://betweengo.com/2010/01/14/limiting-the-quantity-added-to-a-cart/</link>
		<comments>http://betweengo.com/2010/01/14/limiting-the-quantity-added-to-a-cart/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 18:00:00 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[CartModifierFormHandler]]></category>
		<category><![CDATA[ecommerce]]></category>

		<guid isPermaLink="false">http://betweengo.com/2010/01/14/limiting-the-quantity-added-to-a-cart/</guid>
		<description><![CDATA[(Photo: Speed Limit 14 MPH by bredgur) Sometimes the client will ask that the quantity of items you can add to the cart be limited to some number, say 14 like in the photo above. Often people will implement this by putting in checks throughout the JSP.&#160; But this is not the best solution because [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2009/11/02/how-to-add-multiple-items-to-the-shopping-cart-in-atg/' rel='bookmark' title='How to Add Multiple Items to the Shopping Cart in ATG'>How to Add Multiple Items to the Shopping Cart in ATG</a></li>
<li><a href='http://betweengo.com/2007/11/15/sku-and-product-ids-in-commerceitem/' rel='bookmark' title='CommerceItem, which one is the SKU ID?'>CommerceItem, which one is the SKU ID?</a></li>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flickr.com/photos/bredgur/2402977168/"><img style="display: inline; margin-left: 0px; margin-right: 0px" title="Speed Limit 14 MPH on Flickr" alt="Speed Limit 14 MPH on Flickr" src="http://farm4.static.flickr.com/3074/2402977168_32e08bbc26.jpg" /></a> </p>
<p align="center">(Photo: <a title="Speed Limit 14 MPH on Flickr" href="http://www.flickr.com/photos/bredgur/2402977168/">Speed Limit 14 MPH</a> by <a title="Flickr: bredgur&#39;s Photostream" href="http://www.flickr.com/photos/bredgur/">bredgur</a>)</p>
<p>Sometimes the client will ask that the quantity of items you can add to the cart be limited to some number, say 14 like in the photo above. <img src='http://betweengo.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Often people will implement this by putting in checks throughout the JSP.&#160; But this is not the best solution because it is more labor intensive and you may miss something.</p>
<p>Another solution is to deal with the issue in the <a title="CartModifierFormHandler (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.1/apidoc/atg/commerce/order/purchase/CartModifierFormHandler.html">CartModifierFormHandler</a> by extending the <a title="CartModifierFormHandler.doAddItemsToOrder (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.1/apidoc/atg/commerce/order/purchase/CartModifierFormHandler.html#doAddItemsToOrder(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)">doAddItemsToOrder method</a>.&#160; Simply check the quantity of each AddCommerceItemInfo item and make sure that its quantity plus the quantity of the same item already in the cart does not go over the limit.&#160; If it does modify the quantity in the AddCommerceItemInfo item appropriately.</p>
<p>Here is how I implemented this.</p>
<pre>    @Override
    protected void doAddItemsToOrder(DynamoHttpServletRequest pRequest,
            DynamoHttpServletResponse pResponse) throws ServletException,
            IOException {

        // fetch the order
        Order order = getOrder();
        if (order == null) {
            String msg = formatUserMessage(MSG_NO_ORDER_TO_MODIFY, pRequest,
                    pResponse);
            throw new ServletException(msg);
        }

        // iterate through the add commerce item infos, making sure that adding
        // any of them will not result in a quantity greater than LIMIT
        AddCommerceItemInfo[] addCommerceItemInfos = getItems();
        for (int ii = 0; ii &lt; addCommerceItemInfos.length; ii++) {

            // see if there is a commerce item already in the order for the next
            // add commerce item info
            AddCommerceItemInfo addCommerceItemInfo = addCommerceItemInfos[ii];
            String catalogRefId = addCommerceItemInfo.getCatalogRefId();
            CommerceItem commerceItem = findCommerceItemByCatalogRefId(order,
                    catalogRefId);
            if (commerceItem == null) {
                continue;
            }

            // check that the quantity we add won't result in a total quantity
            // greater than LIMIT
            long addQty = addCommerceItemInfo.getQuantity();
            long qty = commerceItem.getQuantity();
            if (qty &gt;= LIMIT) {
                addCommerceItemInfo.setQuantity(0);
            } else if (qty + addQty &gt; LIMIT) {
                long newAddQty = LIMIT - qty;
                addCommerceItemInfo.setQuantity(newAddQty);
            }
        }

        super.doAddItemsToOrder(pRequest, pResponse);
    }

    protected CommerceItem findCommerceItemByCatalogRefId(Order pOrder,
            String pCatalogRefId) {
        for (int ii = 0; ii &lt; numCommerceItems; ii++) {
            CommerceItem commerceItem = (CommerceItem) commerceItems.get(ii);
            String catalogRefId = commerceItem.getCatalogRefId();
            if (catalogRefId.equals(pCatalogRefId))
                return commerceItem;
        }
        return null;
    }</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2010%2F01%2F14%2Flimiting-the-quantity-added-to-a-cart%2F&amp;title=Limiting%20the%20Quantity%20Added%20to%20a%20Cart" id="wpa2a_8"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2009/11/02/how-to-add-multiple-items-to-the-shopping-cart-in-atg/' rel='bookmark' title='How to Add Multiple Items to the Shopping Cart in ATG'>How to Add Multiple Items to the Shopping Cart in ATG</a></li>
<li><a href='http://betweengo.com/2007/11/15/sku-and-product-ids-in-commerceitem/' rel='bookmark' title='CommerceItem, which one is the SKU ID?'>CommerceItem, which one is the SKU ID?</a></li>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2010/01/14/limiting-the-quantity-added-to-a-cart/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NullPointerException in ATG OrderDiscountCalculator</title>
		<link>http://betweengo.com/2009/12/15/nullpointerexception-in-atg-orderdiscountcalculator/</link>
		<comments>http://betweengo.com/2009/12/15/nullpointerexception-in-atg-orderdiscountcalculator/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 13:39:40 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[NullPointerException]]></category>
		<category><![CDATA[OrderDiscountCalculator]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/12/15/nullpointerexception-in-atg-orderdiscountcalculator/</guid>
		<description><![CDATA[(Photo: calculator by ansik) There is a bug in the ATG OrderDiscountCalculator which causes a NullPointerException (NPE) under certain conditions.&#160; Fortunately ATG provides the source for this class (I wish they did for all their classes or at least a larger subset of them) so it was pretty simple to figure out why this was [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2011/03/07/specifying-the-calculator-per-promotion/' rel='bookmark' title='Specifying the Calculator per Promotion'>Specifying the Calculator per Promotion</a></li>
<li><a href='http://betweengo.com/2009/12/20/twitter-weekly-updates-for-2009-12-20/' rel='bookmark' title='Twitter Weekly Updates for 2009-12-20'>Twitter Weekly Updates for 2009-12-20</a></li>
<li><a href='http://betweengo.com/2008/03/10/atg-consulting-interview/' rel='bookmark' title='ATG Consulting Interview'>ATG Consulting Interview</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flickr.com/photos/ansik/304526237/"><img title="calculator on Flickr" alt="calculator on Flickr" src="http://farm1.static.flickr.com/109/304526237_6d1acf58bb.jpg" /></a></p>
<p align="center">(Photo: <a title="calculator on Flickr" href="http://www.flickr.com/photos/ansik/304526237/">calculator</a> by <a title="Flickr: ansik&#39;s Photostream" href="http://www.flickr.com/photos/ansik/">ansik</a>) </p>
<p>There is a bug in the <a title="OrderDiscountCalculator (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.1/apidoc/atg/commerce/pricing/OrderDiscountCalculator.html">ATG OrderDiscountCalculator</a> which causes a <a title="NullPointerException (Java 2 Platform SE 5.0)" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NullPointerException.html">NullPointerException</a> (NPE) under certain conditions.&#160; Fortunately ATG provides the source for this class (I wish they did for all their classes or at least a larger subset of them) so it was pretty simple to figure out why this was happening.</p>
<p>The OrderDiscountCalculator assumes that the taxableShippingGroupSubtotalInfo local will not be null.&#160; If it is an NPE will result when this local is referenced and the page that called this calculator will crash.</p>
<p>The simple fix is to check if it is null and if it is to continue to the next shipping group.</p>
<pre>if (taxableShippingGroupSubtotalInfo == null) {
  continue;
}</pre>
<p>At my request ATG Support has filed a problem report, <a title="ATG - Customer Care Site  - PR #166384 NullPointerException in OrderDiscountCalculator" href="https://www.atg.com/esupport/bugs/?FullViewBug=ViewBug&amp;bugId=166384">NullPointerException in OrderDiscountCalculator</a>.</p>
<p>Update 12-17-2009: ATG may have fixed this issue for ATG 9.1 p1, <a title="ATG - Customer Care Site  - PR #162722 NPE in OrderDiscountCalculator w/empty shipping groups in Order" href="https://www.atg.com/esupport/bugs/?FullViewBug=ViewBug&amp;bugId=162722">NPE in OrderDiscountCalculator w/empty shipping groups in Order</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2009%2F12%2F15%2Fnullpointerexception-in-atg-orderdiscountcalculator%2F&amp;title=NullPointerException%20in%20ATG%20OrderDiscountCalculator" id="wpa2a_10"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2011/03/07/specifying-the-calculator-per-promotion/' rel='bookmark' title='Specifying the Calculator per Promotion'>Specifying the Calculator per Promotion</a></li>
<li><a href='http://betweengo.com/2009/12/20/twitter-weekly-updates-for-2009-12-20/' rel='bookmark' title='Twitter Weekly Updates for 2009-12-20'>Twitter Weekly Updates for 2009-12-20</a></li>
<li><a href='http://betweengo.com/2008/03/10/atg-consulting-interview/' rel='bookmark' title='ATG Consulting Interview'>ATG Consulting Interview</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/12/15/nullpointerexception-in-atg-orderdiscountcalculator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Add Multiple Items to the Shopping Cart in ATG</title>
		<link>http://betweengo.com/2009/11/02/how-to-add-multiple-items-to-the-shopping-cart-in-atg/</link>
		<comments>http://betweengo.com/2009/11/02/how-to-add-multiple-items-to-the-shopping-cart-in-atg/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 19:39:29 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/11/02/how-to-add-multiple-items-to-the-shopping-cart-in-atg/</guid>
		<description><![CDATA[(Photo: Red Cart Conga, Baby by It&#8217;sGreg) ATG’s CartModifierFormHandler has a handle method for adding multiple items to the shopping cart, handleAddMultipleItemsToOrder. &#60;dsp:input type=&#34;submit&#34; bean=&#34;CartModifierFormHandler.addMultipleItemsToOrder&#34; /&#62; What is required is that in the request you set the product ID and SKU ID (catalogRefId) for each product you want to add. &#60;dsp:input bean=&#34;CartModifierFormHandler.productIds&#34; paramvalue=&#34;product.id&#34; type=&#34;hidden&#34; /&#62; [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2010/01/14/limiting-the-quantity-added-to-a-cart/' rel='bookmark' title='Limiting the Quantity Added to a Cart'>Limiting the Quantity Added to a Cart</a></li>
<li><a href='http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/' rel='bookmark' title='How to Add Products to Categories using Content Groups'>How to Add Products to Categories using Content Groups</a></li>
<li><a href='http://betweengo.com/2007/11/15/sku-and-product-ids-in-commerceitem/' rel='bookmark' title='CommerceItem, which one is the SKU ID?'>CommerceItem, which one is the SKU ID?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://www.flickr.com/photos/itsgreg/286126175/"><img title="Red Cart Conga, Baby on Flickr" alt="Red Cart Conga, Baby on Flickr" src="http://farm1.static.flickr.com/121/286126175_adfbe77f4a.jpg" /></a></p>
<p style="text-align: center">(Photo: <a title="Red Cart Conga, Baby on Flickr" href="http://www.flickr.com/photos/itsgreg/286126175/">Red Cart Conga, Baby</a> by <a title="Flickr: It&#39;sGregs photostream" href="http://www.flickr.com/photos/itsgreg/">It&#8217;sGreg</a>)</p>
<p>ATG’s <a title="CartModifierFormHandler (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.0/apidoc/atg/commerce/order/purchase/CartModifierFormHandler.html">CartModifierFormHandler</a> has a handle method for adding multiple items to the shopping cart, <a title="CartModifierFormHandler.handleAddMultipleItemsToOrder(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.0/apidoc/atg/commerce/order/purchase/CartModifierFormHandler.html#handleAddMultipleItemsToOrder%28atg.servlet.DynamoHttpServletRequest,%20atg.servlet.DynamoHttpServletResponse%29">handleAddMultipleItemsToOrder</a>.</p>
<pre>&lt;dsp:input type=&quot;submit&quot; bean=&quot;CartModifierFormHandler.addMultipleItemsToOrder&quot; /&gt;</pre>
<p>What is required is that in the request you set the product ID and SKU ID (catalogRefId) for each product you want to add.</p>
<pre>&lt;dsp:input bean=&quot;CartModifierFormHandler.productIds&quot; paramvalue=&quot;product.id&quot; type=&quot;hidden&quot; /&gt;
&lt;dsp:input bean=&quot;CartModifierFormHandler.catalogRefIds&quot; paramvalue=&quot;sku.id&quot; type=&quot;hidden&quot; /&gt;</pre>
<p>Seems pretty-straightforward, right?&#160; Well there are a couple of tricks.</p>
<p><strong>Trick #1: Setting the quantity</strong></p>
<p>Setting the quantity of the amount of each SKU you want added to the cart requiring naming the quantity input using the SKU iD.</p>
<pre>&lt;input type=&quot;text&quot; name=&quot;&lt;dsp:valueof param=&quot;sku.id&quot;/&gt;&quot; /&gt;</pre>
<p><strong>Trick #2: Handling zero quantity inputs</strong></p>
<p>When the handleAddMultipleItemsToOrder tries to add something that has a quantity of zero or less you it will output an error message that the quantity is zero or less.&#160; If you have a input form where the user does not have to add all the items on the page then this will be problematic.</p>
<p>To get around this restriction I overrode the <a title="CartModifierFormHandler.preAddMultipleItemsToOrder(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG9.0/apidoc/atg/commerce/order/purchase/CartModifierFormHandler.html#preAddMultipleItemsToOrder(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)">preAddMultipleItemsToOrder</a> method.&#160; My method sets the productIds and catalogRefIds properties to only have items that have a quantity greater than zero.</p>
<pre>public void preAddMultipleItemsToOrder(DynamoHttpServletRequest pReq,
    DynamoHttpServletResponse pRes) throws ServletException,
    IOException {

  // get the SKU ID's and product ID's set in the form
  String[] oldCatalogRefIds = getCatalogRefIds();
  String[] oldProductIds = getProductIds();

  // make sure that the SKU ID's and product ID's are valid and of the
  // same length
  if (oldCatalogRefIds == null || oldCatalogRefIds.length == 0)
    return;
  if (oldProductIds == null || oldCatalogRefIds.length != oldProductIds.length) {
    return;
  }

  // initialize list for the SKU ID's and product ID's that we will add to
  // the shopping cart
  List<string> newCatalogRefIdsList = new ArrayList</string><string>(
      oldCatalogRefIds.length);
  List</string><string> newProductIdsList = new ArrayList</string><string>(
      oldCatalogRefIds.length);

  // iterate through original SKU ID's
  for (int ii = 0; ii &lt; oldCatalogRefIds.length; ii++) {

    // get next SKU ID
    String catalogRefId = oldCatalogRefIds[ii];

    // get quantity requested for that SKU ID
    long qty;
    try {
      qty = getQuantity(catalogRefId, pRequest, pResponse);
    } catch (NumberFormatException exc) {
      if (isLoggingDebug())
        logDebug(&quot;invalid quantity for catalogRefId=&quot; + catalogRefId, exc);
      qty = 0;
    }

    // if quantity &gt; 0 then save this SKU ID and it's product ID
    if (qty &gt; 0) {
      newCatalogRefIdsList.add(catalogRefId);
      String productId = oldProductIds[ii];
      newProductIdsList.add(productId);
    }
  }

  // set the catalog ID's property to only have the SKU ID's of things
  // that are being ordered
  String[] newCatalogRefIds = new String[newCatalogRefIdsList.size()];
  newCatalogRefIdsList.toArray(newCatalogRefIds);
  if (isLoggingDebug()) {
    logDebug(&quot;old catalogRefIds=&quot; + Arrays.toString(oldCatalogRefIds)
        + &quot;, new catalogRefIds=&quot;
        + Arrays.toString(newCatalogRefIds));
  }
  setCatalogRefIds(newCatalogRefIds);

  // set the product ID's property to only have the product ID's of things
  // that are being ordered
  String[] newProductIds = new String[newProductIdsList.size()];
  newProductIdsList.toArray(newProductIds);
  if (isLoggingDebug()) {
    logDebug(&quot;old productIds=&quot; + Arrays.toString(oldProductIds)
        + &quot;, new productIds=&quot;
        + Arrays.toString(newProductIds));
  }
  setProductIds(newProductIds);
}</string></pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2009%2F11%2F02%2Fhow-to-add-multiple-items-to-the-shopping-cart-in-atg%2F&amp;title=How%20to%20Add%20Multiple%20Items%20to%20the%20Shopping%20Cart%20in%20ATG" id="wpa2a_12"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2010/01/14/limiting-the-quantity-added-to-a-cart/' rel='bookmark' title='Limiting the Quantity Added to a Cart'>Limiting the Quantity Added to a Cart</a></li>
<li><a href='http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/' rel='bookmark' title='How to Add Products to Categories using Content Groups'>How to Add Products to Categories using Content Groups</a></li>
<li><a href='http://betweengo.com/2007/11/15/sku-and-product-ids-in-commerceitem/' rel='bookmark' title='CommerceItem, which one is the SKU ID?'>CommerceItem, which one is the SKU ID?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/11/02/how-to-add-multiple-items-to-the-shopping-cart-in-atg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update Profile in ATG Commerce</title>
		<link>http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/</link>
		<comments>http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 11:00:00 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[ATG]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[Personalization]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/</guid>
		<description><![CDATA[(Photo: Wolf portrait 3 by Tambako the Jaguar) ProfileTools provides methods for updating a profile.&#160; In ATG Commerce you can access the ProfileTools via the CommerceProfileTools. Therefore to update a profile it is as simple as calling the update methods in ProfileTools. getCommerceProfileTools().updateProperty(propertyName, property, getProfile()); getCommerceProfileTools().updateProperty(propertyTable, getProfile()); The update methods get the MutableRepositoryItem for the [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2009/07/29/atg-product-bundles/' rel='bookmark' title='ATG Product Bundles'>ATG Product Bundles</a></li>
<li><a href='http://betweengo.com/2007/02/07/accessing-javabeans-getters-and-setters/' rel='bookmark' title='Accessing JavaBean&#8217;s Getters and Setters'>Accessing JavaBean&#8217;s Getters and Setters</a></li>
<li><a href='http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/' rel='bookmark' title='How to Add Products to Categories using Content Groups'>How to Add Products to Categories using Content Groups</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://www.flickr.com/photos/tambako/2321286393/"><img title="Wolf portrait 3 on Flickr" alt="Wolf portrait 3 on Flickr" src="http://farm3.static.flickr.com/2099/2321286393_e291026133.jpg" /></a>    <br />(Photo: <a title="Wolf portrait 3 on Flickr" href="http://www.flickr.com/photos/tambako/2321286393/">Wolf portrait 3</a> by <a title="Flickr: Tambako the Jaguar&#39;s Photostream" href="http://www.flickr.com/photos/tambako/">Tambako the Jaguar</a>)</p>
<p><a title="ProfileTools (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/apidoc/atg/userprofiling/ProfileTools.html">ProfileTools</a> provides methods for updating a profile.&#160; In ATG Commerce you can access the ProfileTools via the <a title="CommerceProfileTools (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/apidoc/atg/commerce/profile/CommerceProfileTools.html">CommerceProfileTools</a>.</p>
<p>Therefore to update a profile it is as simple as calling the update methods in ProfileTools.</p>
<pre>getCommerceProfileTools().updateProperty(propertyName,
                                         property, getProfile());

getCommerceProfileTools().updateProperty(propertyTable, getProfile());</pre>
<p>The update methods get the MutableRepositoryItem for the profile, set the property in the MutableRepositoryItem and then update the item in the ProfileRepository.</p>
<p>Pretty simple, eh? <img src='http://betweengo.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2009%2F09%2F08%2Fupdate-profile-in-atg-commerce%2F&amp;title=Update%20Profile%20in%20ATG%20Commerce" id="wpa2a_14"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2009/07/29/atg-product-bundles/' rel='bookmark' title='ATG Product Bundles'>ATG Product Bundles</a></li>
<li><a href='http://betweengo.com/2007/02/07/accessing-javabeans-getters-and-setters/' rel='bookmark' title='Accessing JavaBean&#8217;s Getters and Setters'>Accessing JavaBean&#8217;s Getters and Setters</a></li>
<li><a href='http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/' rel='bookmark' title='How to Add Products to Categories using Content Groups'>How to Add Products to Categories using Content Groups</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/09/08/update-profile-in-atg-commerce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Debug an InvalidVersionException from Updating an ATG Order</title>
		<link>http://betweengo.com/2009/08/17/how-to-debug-an-invalidversionexception-from-updating-an-atg-order/</link>
		<comments>http://betweengo.com/2009/08/17/how-to-debug-an-invalidversionexception-from-updating-an-atg-order/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 17:40:19 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[transactions]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/08/17/how-to-debug-an-invalidversionexception-when-updating-an-atg-order/</guid>
		<description><![CDATA[If you ever update an order outside of a transaction then the next time you update it within a transaction you will get the infamous, dreaded InvalidVersionException. WARN atg.commerce.order.ShoppingCartModifier atg.commerce.order.InvalidVersionException: This order (o3830002) is out of date. Changes have been made to the order and the operation should be resubmitted. Order version 333, Repository item [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2010/11/14/load-atg-order/' rel='bookmark' title='Load ATG Order'>Load ATG Order</a></li>
<li><a href='http://betweengo.com/2009/07/28/how-to-debug-no-output-for-atg-foreach/' rel='bookmark' title='How to Debug No Output for ATG ForEach'>How to Debug No Output for ATG ForEach</a></li>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://www.flickr.com/photos/66164549@N00/2487291985/"><img title="I thought I saw a puddy cat.... on Flickr" src="http://farm4.static.flickr.com/3067/2487291985_fe237bde20.jpg" alt="I thought I saw a puddy cat.... on Flickr" /></a></p>
<p>If you ever update an order outside of a transaction then the next time you update it within a transaction you will get the infamous, dreaded <tt><a title="InvalidVersionException (ATG Java API)" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/apidoc/atg/commerce/order/InvalidVersionException.html">InvalidVersionException</a></tt>.</p>
<pre>WARN  atg.commerce.order.ShoppingCartModifier
atg.commerce.order.InvalidVersionException: This order (o3830002) is out of date. Changes have been made to the order and the operation should be resubmitted. Order version 333, Repository item version 334.
   at atg.commerce.order.OrderManager.updateOrder(OrderManager.java:2557)</pre>
<p>For example this could happen if you update your order in your JSP page.</p>
<pre>&lt;dsp:setvalue bean=”order.foo” value=”bar” /&gt;</pre>
<p><strong>To fix this problem you must always make sure to update an order within a transaction like this.</strong></p>
<pre>Transaction tr = null;
try {
  tr = ensureTransaction();
  synchronized (getOrder()) {
    getOrder().setFoo("bar");
    try {
      getOrderManager().updateOrder(order);
    }
    catch (Exception exc) {
      processException(exc, MSG_ERROR_UPDATE_ORDER, pRequest, pResponse);
    }
  }
}
finally {
  if (tr != null) commitTransaction(tr);
}</pre>
<p>In some cases you might find a method is called within a transaction by another method and in other cases it is not.</p>
<pre>public boolean handleFoo(DynamoHttpServletRequest req, DynamoHttpServletResponse res) {
  Transaction tr = null;
  try {
    tr = ensureTransaction();
    synchronized (getOrder()) {
      setFoo("bar");
      try {
        getOrderManager().updateOrder(order);
      }
      catch (Exception exc) {
        processException(exc, MSG_ERROR_UPDATE_ORDER, pRequest, pResponse);
      }
    }
    return checkFormRedirect(getSuccessUrl(), getErrorUrl(), req, res);
  }
  finally {
    if (tr != null) commitTransaction(tr);
  }
}

public void setFoo(String foo) {
  getOrder().setFoo(foo);
}</pre>
<p>In the above example the <tt>handleFoo</tt> method properly updates the order within the transaction.  However calling the <tt>setFoo</tt> method directly will cause a problem since the order is not updated within a transaction.  To fix this you use the same pattern again to ensure the order is updated within a transaction.  It is okay to do this more than once during a request.</p>
<p><strong>To debug this problem you can use Eclipse to make sure that wherever you update an order is always within a transaction.</strong> You can use the debugger to find which methods are called and/or you can use the call hierarchy to find out how methods are called.</p>
<p><strong>Another way to help debug this is adding JSP code similar to the one I list below.</strong> It outputs the version of the order that the form handler has and the version that is in the repository.  If there is a difference then you know that the action you took before at some point updated the order outside of a transaction.</p>
<pre>&lt;dspel:getvalueof bean="ShoppingCartModifier.order.id" var="orderId" /&gt;
FORM HANDLER ORDER ID: ${orderId}&lt;br/&gt;
FORM HANDLER ORDER VERSION: &lt;dsp:valueof bean="ShoppingCartModifier.order.version" /&gt;&lt;br/&gt;
&lt;dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach"&gt;
  &lt;dsp:param name="queryRQL" value="ID IN { \"${orderId}\" }"/&gt;
  &lt;dsp:param name="repository" value="/atg/commerce/order/OrderRepository"/&gt;
  &lt;dsp:param name="itemDescriptor" value="order"/&gt;
  &lt;dsp:oparam name="output"&gt;
    REPOSITORY ORDER VERSION: &lt;dsp:valueof param="element.version"/&gt;&lt;br/&gt;
  &lt;/dsp:oparam&gt;
&lt;/dsp:droplet&gt;</pre>
<p>For further reading please see <a title="Nabble - ATG Dynamo - Commerce Assist Returns" href="http://www.nabble.com/Commerce-Assist-Returns-td15539950.html">Nabble &#8211; ATG Dynamo &#8211; Commerce Assist Returns</a> and the <a title="Transaction Management" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/dynprog/dynprog0801.html">Transaction Management section</a> in the <a title="ATG Dynamo Programming Guide" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/dynprog/index.html">ATG Programming Guide</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2009%2F08%2F17%2Fhow-to-debug-an-invalidversionexception-from-updating-an-atg-order%2F&amp;title=How%20to%20Debug%20an%20InvalidVersionException%20from%20Updating%20an%20ATG%20Order" id="wpa2a_16"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2010/11/14/load-atg-order/' rel='bookmark' title='Load ATG Order'>Load ATG Order</a></li>
<li><a href='http://betweengo.com/2009/07/28/how-to-debug-no-output-for-atg-foreach/' rel='bookmark' title='How to Debug No Output for ATG ForEach'>How to Debug No Output for ATG ForEach</a></li>
<li><a href='http://betweengo.com/2009/11/12/the-dangers-of-custom-atg-repository-ids/' rel='bookmark' title='The Dangers of Custom ATG Repository ID&rsquo;s.'>The Dangers of Custom ATG Repository ID&rsquo;s.</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/08/17/how-to-debug-an-invalidversionexception-from-updating-an-atg-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Add Products to Categories using Content Groups</title>
		<link>http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/</link>
		<comments>http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 21:22:45 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[Personalization]]></category>
		<category><![CDATA[ACC]]></category>
		<category><![CDATA[ATG]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[targeting]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/</guid>
		<description><![CDATA[Typically after you create a category in your catalog you then add products to the category.  The simple way to do that in ATG eCommerce is to use the ACC and add products to the child products property of the category.  However there is another way. In the ATG Commerce Guide to Setting Up a [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2007/12/07/debugging-category-bad-child-products/' rel='bookmark' title='Debugging a Category&#8217;s Bad Child Products'>Debugging a Category&#8217;s Bad Child Products</a></li>
<li><a href='http://betweengo.com/2009/07/29/atg-product-bundles/' rel='bookmark' title='ATG Product Bundles'>ATG Product Bundles</a></li>
<li><a href='http://betweengo.com/2008/04/16/setting-up-cygwin-users-and-groups/' rel='bookmark' title='Setting up cygwin users and groups'>Setting up cygwin users and groups</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Typically after you create a category in your catalog you then add products to the category.  The simple way to do that in ATG eCommerce is to use the ACC and add products to the child products property of the category.  However there is another way.</p>
<p>In the <a title="ATG Commerce Guide to Setting Up a Store" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/commstore/index.html">ATG Commerce Guide to Setting Up a Store documentation</a> you can see in the <a title="ATG Commerce Guide to Setting Up a Store - Viewing the Product Catalog" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/commstore/commstore0204.html">Viewing the Product Catalog</a> section that a category can have child products but also child product groups.</p>
<p style="text-align: center;"><a href="http://betweengo.com/wp-content/uploads/2009/07/product-catalog.gif"><img class="size-medium wp-image-807 aligncenter" title="Product Catalog" src="http://betweengo.com/wp-content/uploads/2009/07/product-catalog-500x363.gif" alt="Product Catalog" width="500" height="363" /></a></p>
<p>Child product groups are actually content groups which are described in the <a title="Creating Content Groups" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/business/business0601.html">Creating Content Groups</a> chapter of the <a title="ATG Personalization Guide for Business Users" href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/business/index.html">ATG Personalization Guide for Business Users</a>.</p>
<p><a href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/business/business0602.html"><img class="aligncenter size-medium wp-image-811" title="Targeting &gt; Profile and Content Groups window" src="http://betweengo.com/wp-content/uploads/2009/07/Image1952-500x312.gif" alt="Targeting &gt; Profile and Content Groups window" width="500" height="312" /></a></p>
<p>Though the documentation shows a content group composed of features you can easily create a content group using the <tt>ProductCatalog</tt> as a content source and <tt>product</tt> as a content type.</p>
<p>To create a content group follow the steps in the ATG documentation for <a href="http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/business/business0603.html">Creating New Content Groups</a> except use an item from the <tt>ProductCatalog</tt> when specifying the Content Type.  Then create the targeting rules for this Content Group.  Now you can specify this group in the <tt>Child products (group)</tt> property of a category.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2009%2F07%2F31%2Fhow-to-add-products-to-categories-using-content-groups%2F&amp;title=How%20to%20Add%20Products%20to%20Categories%20using%20Content%20Groups" id="wpa2a_18"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2007/12/07/debugging-category-bad-child-products/' rel='bookmark' title='Debugging a Category&#8217;s Bad Child Products'>Debugging a Category&#8217;s Bad Child Products</a></li>
<li><a href='http://betweengo.com/2009/07/29/atg-product-bundles/' rel='bookmark' title='ATG Product Bundles'>ATG Product Bundles</a></li>
<li><a href='http://betweengo.com/2008/04/16/setting-up-cygwin-users-and-groups/' rel='bookmark' title='Setting up cygwin users and groups'>Setting up cygwin users and groups</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/07/31/how-to-add-products-to-categories-using-content-groups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ATG Product Bundles</title>
		<link>http://betweengo.com/2009/07/29/atg-product-bundles/</link>
		<comments>http://betweengo.com/2009/07/29/atg-product-bundles/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 11:00:00 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Commerce]]></category>
		<category><![CDATA[ATG]]></category>
		<category><![CDATA[ecommerce]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/07/29/atg-product-bundles/</guid>
		<description><![CDATA[Out of the box ATG eCommerce does not support product bundles.&#160; It does support SKU bundles, i.e. a product can consist of multiple SKU’s. To support product bundles is pretty simple to implement. First you create a new type of product for bundles in /atg/commerce/catalog/productCatalog.xml. &#60;item-descriptor name=&#34;product&#34;&#62; &#60;table name=&#34;dcs_product&#34;&#62; &#60;property name=&#34;type&#34; data-type=&#34;enumerated&#34; default=&#34;regular&#34;&#62; &#60;attribute name=&#34;useCodeForValue&#34; [...]
Related posts:<ol>
<li><a href='http://betweengo.com/2005/07/28/user-defined-property-type-gotchas/' rel='bookmark' title='user-defined property type gotcha&#8217;s'>user-defined property type gotcha&#8217;s</a></li>
<li><a href='http://betweengo.com/2010/01/21/specifying-one-to-many-relationship-in-atg-repositories/' rel='bookmark' title='Specifying One-to-Many Relationship in ATG Repositories'>Specifying One-to-Many Relationship in ATG Repositories</a></li>
<li><a href='http://betweengo.com/2008/02/11/shopcom-product-display-integration/' rel='bookmark' title='Shop.com Product Display Integration'>Shop.com Product Display Integration</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://www.flickr.com/photos/joeyparsons/3352561284/"><img class="aligncenter" title="what&#39;s in my sxsw schwag bag - photo by joey.parsons - Flickr" alt="what&#39;s in my sxsw schwag bag - photo by joey.parsons - Flickr" src="http://farm4.static.flickr.com/3421/3352561284_992ee02488.jpg?v=0" width="500" height="331" /></a></p>
<p>Out of the box ATG eCommerce does not support product bundles.&#160; It does support SKU bundles, i.e. a product can consist of multiple SKU’s.</p>
<p>To support product bundles is pretty simple to implement.</p>
<p>First you create a new type of product for bundles in <tt>/atg/commerce/catalog/productCatalog.xml</tt>.</p>
<pre>&lt;item-descriptor name=&quot;product&quot;&gt;
 &lt;table name=&quot;dcs_product&quot;&gt;
  &lt;property name=&quot;type&quot; data-type=&quot;enumerated&quot; default=&quot;regular&quot;&gt;
   &lt;attribute name=&quot;useCodeForValue&quot; value=&quot;false&quot;/&gt;
   &lt;option value=&quot;regular&quot; code=&quot;0&quot;/&gt;
   &lt;option value=&quot;bundle&quot; code=&quot;1&quot; /&gt;
 &lt;/property&gt;
 &lt;/table&gt;</pre>
<p>
  <br />Then you define your bundles product to have the new products property. This property is simply a list of products that the bundle contains, e.g. Costco organic cotton polo shirt and Nike athletic shorts.</p>
<p></p>
<pre>&lt;item-descriptor name=&quot;bundle&quot; super-type=&quot;product&quot; sub-type-value=&quot;bundle&quot;&gt;
 &lt;table name=&quot;betweengo_product_bundle&quot; multi-column-name=&quot;seq_num&quot;
  type=&quot;multi&quot; id-column-names=&quot;product_bundle_id&quot;&gt;
  &lt;property name=&quot;products&quot; column-name=&quot;product_id&quot; data-type=&quot;list&quot;
   component-item-type=&quot;product&quot; display-name=&quot;Products&quot; category=&quot;Bundle&quot; /&gt;
 &lt;/table&gt;
&lt;/item-descriptor&gt;</pre>
<p>A few years ago I did a more advanced version of this implementation which allowed for different numbers of products in one bundle, e.g. two different kinds of shirts and one pair of pants.&#160; I did this using the concept of product links which is similar to SKU links that ATG supports.</p>
<p>If you are interested in wanting to implement a more advanced version <a title="Contact betweenGo" href="http://betweengo.com/contact-us/contact-form/?your_subject=Sales">please contact us</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbetweengo.com%2F2009%2F07%2F29%2Fatg-product-bundles%2F&amp;title=ATG%20Product%20Bundles" id="wpa2a_20"><img src="http://betweengo.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://betweengo.com/2005/07/28/user-defined-property-type-gotchas/' rel='bookmark' title='user-defined property type gotcha&#8217;s'>user-defined property type gotcha&#8217;s</a></li>
<li><a href='http://betweengo.com/2010/01/21/specifying-one-to-many-relationship-in-atg-repositories/' rel='bookmark' title='Specifying One-to-Many Relationship in ATG Repositories'>Specifying One-to-Many Relationship in ATG Repositories</a></li>
<li><a href='http://betweengo.com/2008/02/11/shopcom-product-display-integration/' rel='bookmark' title='Shop.com Product Display Integration'>Shop.com Product Display Integration</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/07/29/atg-product-bundles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
