<!--- Retrieve items currently in user's cart --->
<CF_ShoppingCart 
  Action="List" 
  ReturnVariable="GetCart">

<!--- Assuming there is at least one item in cart --->	
<CFIF GetCart.RecordCount GT 0>

  <!--- Convert items to comma-separated list --->	
	<CFSET CurrentMerchList = ValueList(GetCart.MerchID)>
	
  <!--- Run query to suggest other items for user to buy --->
  <CFQUERY NAME="GetSimilar" DATASOURCE="#REQUEST.DataSource#">
    <!--- We want all items NOT in user's cart... --->
    SELECT ItemID
    FROM MerchandiseOrdersItems
    WHERE ItemID NOT IN (#CurrentMerchList#)
    <!--- ...but that *were* included in other orders --->
    <!--- along with items now in the user's cart... --->
    AND OrderID IN 
      (SELECT OrderID FROM MerchandiseOrdersItems
       WHERE ItemID IN (#CurrentMerchList#)
       <!--- ...not including this user's past orders! --->
       AND OrderID NOT IN
         (SELECT OrderID FROM MerchandiseOrders
          WHERE ContactID = #SESSION.Auth.ContactID#)  )
  </CFQUERY>
	
  <!--- If at least one "similar" item was found --->
	<CFIF GetSimilar.RecordCount GT 0>
	  <!--- For each similar item, display it, via Custom Tag --->
    <CFLOOP QUERY="GetSimilar">
	    <CF_MerchDisplay 
        MerchID="#GetSimilar.ItemID#">
    </CFLOOP>
  </CFIF>
</CFIF>