The next code sample is also a modified version of the crossSiteLinkGenerator.jsp page. It uses SiteIdForCatalogItem in conjunction with SiteLinkDroplet to generate a URL that follows this pattern:

production-URL/product-template/product-ID

For example:

/crs/storeus/browse/productDetailsSingleSku.jsp?productId=xprod200

The product template that gets used depends on the product you are creating a link for, hence, the dynamic nature of this example. In the URL above, /crs/storeus is the production-URL, /browse/productDetailsSingleSku.jsp is the product-template and ?productId=xprod200 is the product-ID. Here is the code sample:

<dsp:getvalueof var="product" param="product"/>
<dsp:droplet name="/atg/commerce/multisite/SiteIdForCatalogItem"
             item="${product}" var="siteIdForCatalogItem">
   <dsp:oparam name="output">

      <%-- Pass the site ID and the product's template path to SiteLinkDroplet to
        get a site-specific URL to the product template. --%>
      <dsp:getvalueof var="urlToUpdate" param="product.template.url"/>
      <dsp:droplet name="/atg/dynamo/droplet/multisite/SiteLinkDroplet"
                   siteId="${siteIdForCatalogItem.siteId}"
                   path="${urlToUpdate}" var="siteLink">
         <dsp:oparam name="output">

            <%-- Render the generated URL to the product template, appended with
              the product ID. --%>
            <dsp:a href="${siteLink.url}">
               <dsp:param name="productId" param="product.repositoryId"/>
               <dsp:valueof param="product.displayName"/>
            </dsp:a>

        </dsp:oparam>
      </dsp:droplet>
   </dsp:oparam>
</dsp:droplet>

This code sample resolves the various portions of the URL as follows:

Additional Notes:


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