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:

The following code in store.war/atgsearch/gadgets/atgSearch.jsp creates this search control. Based on what the user selects, the code sets the QueryFormHandler.searchRequet.dynamicTargetSpecifier.siteIdsArray property, which specifies the sites to search.
<dsp:droplet name="SharingSitesDroplet" shareableTypeId="atg.ShoppingCart"
excludeInputSite="true" var="sharingSites">
<dsp:oparam name="output">
<%-- Loop through the sites --%>
<dsp:droplet name="ForEach" array="${sharingSites.sites}" var="current">
<%-- Set to search the current site --%>
<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>
