Upsell V3 - add a link to the main product to the popup
Posted: Tue Oct 23, 2012 5:19 pm
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.
Note that both a text link and a button are provided. Remove / amend as needed.
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();" />