Upsell V3 - add a link to the main product to the popup

Adding upsell items to a product.
Post Reply
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Upsell V3 - add a link to the main product to the popup

Post by norman »

To add a link to the main product to the popup/greybox that will dismiss the popup and open the main page at that product, put the following into layout Upsell Popup where you want the link to occur.

Code: Select all

<!-- Start - Code to link to main product - Put only once on page -->
<script type="text/javascript">
   function gotomainproduct(){
   var prodlink = '<actinic:variable name="SearchCGIURL" encoding="perl" selectable="false" />?PRODREF=<actinic:variable Name="ProductID" encoding="perl" selectable="false" />&NOLOGIN=1<actinic:block if="%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e">&SHOP=<actinic:variable name="ShopID" /></actinic:block>';
   if (window.name == 'RelatedPopup')	// Upsell in a popup window
		{
		if( opener )
			{
			opener.location.href = prodlink;
			setTimeout('window.close()',1000);
			return true;
			}
		else
			{
			alert('Cannot locate product page. Make sure the original product page is being displayed and try again.');
			setTimeout('window.close()',1000);
			return false;
			}
		}
	else											// Upsell in a Greybox 
		{
		if( top.window )
			{
			top.window.location.href = prodlink;
			setTimeout('window.close()',1000);
			return true;
			}
		else
			{
			alert('Cannot locate product page. Make sure the original product page is being displayed and try again.');
			setTimeout('window.close()',1000);
			return false;
			}
		}
   }
</script>
<!-- End - Code to link to main product - Put only once on page -->

<!-- Links to product - may be repeated if required -->
<a href="#" onclick="gotomainproduct();">See main product</a>
<input type="button" value="See main product" onclick="gotomainproduct();" />
Note that both a text link and a button are provided. Remove / amend as needed.
Norman
Post Reply