Commerce Reference Store includes a multisite search control that allows customers to search only the current site or to search the sites that share a shopping cart with the current site. For example:

This illustration is described in the surrounding text.

The following code in store.war/atgsearch/gadgets/atgSearch.jsp creates this search control. Based on what the user selects, the code sets the value of the siteIdsArray property of the DynamicTargetSpecifier component, which specifies the sites to search:

<dsp:droplet name="SharingSitesDroplet" shareableTypeId="atg.ShoppingCart"
     excludeInputSite="true" var="sharingSites">
  <dsp:oparam name="output">
    <%-- Sort sites --%>

    <%-- Loop through the sites --%>
    <dsp:droplet name="ForEach" array="${sharingSites.sites}" var="current">

      <%-- current site, selected and disabled --%>
      <dsp:oparam name="outputStart">
        <dsp:input
         bean="QueryFormHandler.searchRequest.dynamicTargetSpecifier.siteIdsArray"
         type="hidden" value="${currentSite.id}" priority="10" />
      </dsp:oparam>

      <%-- other sites --%>
      <dsp:oparam name="output">
        <dsp:setvalue param="site" value="${current.element}"/>
        <dsp:getvalueof var="siteId" param="site.id"/>
        <div>
        <dsp:input
         bean="QueryFormHandler.searchRequest.dynamicTargetSpecifier.siteIdsArray"
         type="checkbox" value="${siteId}" priority="10" id="otherStore"
         checked="false"/>
          <label for="otherStore">
            <fmt:message key="search.otherStoresLabel">
              <fmt:param>
                <dsp:valueof param="site.name"/>
              </fmt:param>
            </fmt:message>
          </label>
        </div>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:oparam>

  <dsp:oparam name="empty">
    <dsp:input
      bean="QueryFormHandler.searchRequest.dynamicTargetSpecifier.siteIdsArray"
      type="hidden" value="${currentSite.id}" priority="10" />
  </dsp:oparam>
</dsp:droplet>