Set up Global Cross Sell

General ShopSite user discussion

Set up Global Cross Sell

Postby dgroff » Fri Aug 19, 2011 6:10 am

I am trying to set up Global Cross Sell on a product template page. So far under Merchandising > Cross Sell, I turned on Global Cross Sell, assigned 12 items to it and assigned 'random' to how it will display.

On the template i have this so far:
[-- DEFINE GLOBAL_CROSS_SELL --]
<tr>
<td>
<img src="../media/[-- IMAGE Product.MoreInformationGraphic --]" height="100px" />
<br />
[-- IF Product.DisplayMoreInformationPage --]
<a href="[-- Product.MoreInfoURL --]"><strong>[-- Product.Name --]</strong></a>
[-- ELSE --]
<strong>[-- Product.Name --]</strong>
[-- END_IF --]
<br />
[-- Product.SKU --]
<br /><br />
[-- IF PRODUCT.SaleOn --]
<span class="fl-priceslash">[-- PRODUCT.Price --]</span><br />
<span class="fl-saleprice">[-- PRODUCT.SaleAmount --]</span>
[-- ELSE --]
<span class="fl-price">[-- PRODUCT.Price --]</span>
[-- END_IF --]
<br />
<input type="checkbox" name="itemnum" value="[-- Product.RecordNumber --]" id="[-- Product.RecordNumber --]" class="checkboxQuantity">
<input type="text" name="[-- Product.RecordNumber --]:qnty" onkeyup="javascript: document.getElementById('[-- Product.RecordNumber --]').checked=(this.value!='')?true:false" class="inputQuantity">
<input type="image" value="submit" src="/graphics/addtocart.gif" alt="Add to Cart" />
<br /><br /><br />
</td>
</tr>
[-- END_DEFINE GLOBAL_CROSS_SELL --]

And then I have:
[-- IF Product.CrossSell 0 --]
<table>
<caption>[-- STORE.GlobalCrossSellHeader --]</caption>
[-- LOOP GLOBAL_Cross_Sell --]
[-- GLOBAL_CROSS_SELL --]
[-- END_LOOP Global_Cross_Sell --]
</table>
[-- ELSE --]
<script language="javascript" type="text/javascript">
function checkQuantity() {

var order = document.getElementById('orderingTable').getElementsByTagName('input')
var validate = false;

for ( i = 0; i < order.length; i++ ) {
if ( order[i].checked == true ) {
validate = true;
break;
}
}

if ( validate == false ) {
alert("You must enter a quantity for at least one item.");
}

return validate;

}
</script>
<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method="post" onSubmit="return checkQuantity()">
<input type="hidden" name="storeid" value="[-- STORE_ID --]">
<input type="hidden" name="dbname" value="products">
<input type="hidden" name="function" value="add">
<table border="0" cellpadding="5" cellspacing="0" id="orderingTable">
[-- LOOP PRODUCT_CROSS_SELL --]
[-- PRODUCT_CROSS_SELL --]
[-- END_LOOP PRODUCT_CROSS_SELL --]
</table>
</form>
</div>
[-- END_IF --]


The Product Cross Sell works.

I am trying to get this to work on this page http://www.bakersgas.com/safety/EDG-XB.html
dgroff
 
Posts: 28
Joined: Fri May 27, 2011 8:43 am

Re: Set up Global Cross Sell

Postby dgroff » Fri Aug 19, 2011 7:09 am

Nevermind I figured it out.

Move the DEFINE GLOBAL CROSS SELL to the shopping cart template and it works!
dgroff
 
Posts: 28
Joined: Fri May 27, 2011 8:43 am

Re: Set up Global Cross Sell

Postby Jim » Fri Aug 19, 2011 8:27 am

Yes, since the Global Cross sell is global there is no sense in putting the [-- DEFINE GLOBAL_CROSS_SELL --] in multiple places. Since it was allowed in the shopping cart a version before it was allowed on store pages it was left in the shopping cart template. Actually that is probably the only "global" place it could be put since there is only one active shopping cart template per store. Adding it to a page or product template would only allow it on those pages or products and it wouldn't be global.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: No registered users and 8 guests