0

I have HTML code that I use in the < / body > section of my website for a universal floating "View Cart" widget so that items added to the shopping cart can be viewed from any page on my site, but I would like for it not to show up on the Home page. Is there code that can be added to keep it from showing up on just that one page?

Here is the code I'm using:

<!-- Begin Mal's floating cart Form -->
<div style="position:fixed; top:20px; right:20px; width:100px; border-radius:5px; padding:5px; font-family:Verdana, sans-serif; font-size:0.7em; border:1px solid #333333; background-color:#fffdfc;">
<script type="text/javascript">
//<![CDATA[
// nothing to touch here
function SetCookie(cookieName,cookieValue,mins){
var today = new Date();
var expire = new Date();
expire.setTime(today.getTime() + 60000*mins);
document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}
function ReadCookie(cookieName){
var theCookie=""+document.cookie;
var ind=theCookie.indexOf(cookieName);
if (ind==-1 || cookieName=="") return ""; 
var ind1=theCookie.indexOf(';',ind);
if (ind1==-1) ind1=theCookie.length;
return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
var loc = document.location;
var cookieResult = ReadCookie("gt_mals_total");
if (loc.search){
var search = loc.search.slice(1);
if (search.indexOf("qty") >= 0){
SetCookie('gt_mals_total',search,30); //30 mins
}
}

function deleteCookie(cookieName) {
if (document.cookie != document.cookie) {
index = document.cookie.indexOf(cookieName);
} else {
index = -1;
}
if (index == -1) {
document.cookie=cookieName+"=GONEcbEndCookie; expires=Monday, 19-Aug-1996 05:00:00 GMT";
}
//document.location.href = document.location.href;
//to reload without queryString parameters, use the line below instead
document.location = document.location.href.substring(0,document.location.href.indexOf("?"));
} 

// end of nothing to touch here

// adjust the width below to suit your needs
document.write("<table class=\"total\"\>");
// end of adjust the width below to suit your needs

// nothing to touch here
var cookieResult = ReadCookie("gt_mals_total");
if (cookieResult == ""){
document.write("<tr><td colspan=\"2\" style=\"align:center\"><strong>CART</strong><br>Items: 0<br>Total: $0.00</td></tr>");
} else {
var valsArray = cookieResult.split("&");
for (i in valsArray){
var thisValPair = valsArray[i];
var thisValArray = thisValPair.split("=");
var thisName = thisValArray[0];
var thisVal = thisValArray[1];
// end of nothing to touch here

if (thisName == "qty"){
document.write("<tr><td>Items:</td><td style=\"align:right\">" + Math.floor(thisVal) + "</td></tr>");
}
if (thisName == "tot"){
document.write("<tr><td>Total:</td><td style=\"align:right\">" + "$" + thisVal + "</td></tr>");
// change the above "£" symbol to your currency symbol, example "$".
}
}
document.write("<tr><td colspan=\"2\"><a href=\"https://ww#.aitsafe.com/cf/review.cfm?userid=########&return=https://MYWEBSITE/\"_target_ >VIEW CART</a></td></tr>");
// change the return url to your page url above
}
document.write("</table>");
//]]>
</script>
</div>
<!-- End Mal's floating cart Form -->

0

Browse other questions tagged or ask your own question.