remove the hyperlink on the minicart

Questions and answers about ShopSite Custom Templates

remove the hyperlink on the minicart

Postby chico » Wed Mar 31, 2010 10:31 am

I have my minicart set up using ItemCount Style. I don't have the graphic showing, and the cart is working properly. However, I don't want the number of items showing to be a hyperlink. I still want the number to show, just not linked. I have a link to the cart elsewhere. Any idea how to do it?

Here is my minicart include:
Code: Select all
#### Mini Cart ItemCount Display ####

#### YOU CAN CHANGE THESE VALUES IF NEEDED ####
[-- IF PAGE.LinkColor --]
  [-- VAR.MiniCartTextColor "#ffffff" --]
#  [-- VAR.MiniCartBackgroundColor PAGE.BackgroundColor --]
  [-- VAR.MiniCartBackgroundColor "transparent" --]
[-- ELSE --]
  [-- VAR.MiniCartTextColor MORE_INFO.LinkColor --]
#  [-- VAR.MiniCartBackgroundColor MORE_INFO.BackgroundColor --]
  [-- VAR.MiniCartBackgroundColor "transparent" --]
[-- END_IF --]
[-- VAR.ShowCart "no" --]
[-- VAR.MiniCartColor "black" --]
[-- VAR.TextAlign "left" --]

#### DON'T CHANGE ANYTHING BELOW HERE ####

<script language="javascript">
var cookies=document.cookie;  //read in all cookies
var start = cookies.indexOf("ss_cart_[-- STORE_Serial_Number --]=");
var cartvalues = "";
var linecount = 0;
var start1;
var end1;
var tmp;

// Start Output
document.write("<div style=\"color: [-- VAR.MiniCartTextColor --];");
document.write("background-color: [-- VAR.MiniCartBackgroundColor --];");
document.write("text-align: [-- VAR.TextAlign --];");
document.write("font-family: Verdana, Arial, Helvetica, sans-serif;");
document.write("font-size: 8pt;");
document.write("\">\n");

[-- IF VAR.ShowCart "yes" --]
  document.write("<a href=\"[-- SHOPPING_CART_URL --]\"");
  document.write("style=\"text-decoration: underline;");
  document.write("color: [-- VAR.MiniCartTextColor --];");
  document.write("\">");
  document.write("<img src=\"[-- OUTPUT_DIRECTORY_URL --]/media/themesmedia/cart-[-- VAR.MiniCartColor --].gif\" border=\"0\" name=\"cart\" align=\"top\">");
  document.write("</a> ");
[-- END_IF --]

if (start == -1)  //No cart cookie
{
  document.write("<a href=\"[-- SHOPPING_CART_URL --]\"");
  document.write("style=\"text-decoration: underline;");
  document.write("color: [-- VAR.MiniCartTextColor --];");
  document.write("\">");
  document.write("0 [-- STORE.Items --]");
  document.write("</a>");
  document.write("</div>\n");
}
else   //cart cookie is present
{
  start = cookies.indexOf("=", start) +1; 
  var end = cookies.indexOf(";", start); 

  if (end == -1)
  {
    end = cookies.length;
  }

  cartvalues = unescape(cookies.substring(start,end)); //read in just the cookie data

  start = 0;
  while ((start = cartvalues.indexOf("|", start)) != -1)
  {
    start++;
    end = cartvalues.indexOf("|", start);
    if (end != -1)
    {
      linecount++;

      if (linecount == 2) // Total Quantity of Items
      {
        tmp = cartvalues.substring(start,end);
        colon = tmp.indexOf(":", 0);
        document.write("<a href=\"[-- SHOPPING_CART_URL --]\"");
        document.write("style=\"text-decoration: underline;");
        document.write("color: [-- VAR.MiniCartTextColor --];");
        document.write("\">");
        document.write(tmp.substring(colon+1,end - start));
        if ((tmp.substring(colon+1,end - start)) == 1 )
        {
          document.write(" [-- STORE.Item --]");
        }
        else
        {
          document.write(" [-- STORE.Items --]");
        }
      document.write("</a>");
      }

      start = end;
    }
    else
      break;
    }
  } // end while loop

  //close minicart HTML
  document.write("</div>\n");
</script>


Thanks.
chico
 
Posts: 31
Joined: Tue Mar 09, 2010 4:03 pm
Location: Central North America

Postby BFChris » Wed Mar 31, 2010 10:54 am

Yes, remove the <a href> sections from the document.write functions.

So you need to take out:

Code: Select all
document.write("<a href=\"[-- SHOPPING_CART_URL --]\"");
  document.write("style=\"text-decoration: underline;");
  document.write("color: [-- VAR.MiniCartTextColor --];");
  document.write("\">");


and

Code: Select all
  document.write("</a> ");


three times. (The code is used in different parts of the conditional IF statement.)
~~Barefoot Chris
--------------------------------
Barefoot Chris Web Design
www.barefootchris.net
--------------------------------
BFChris
 
Posts: 322
Joined: Mon Oct 09, 2006 3:28 pm
Location: PA

Postby chico » Wed Mar 31, 2010 11:44 am

Thanks! It worked. I didn't see it in there three times. I pulled it 2 times and it was still showing!
chico
 
Posts: 31
Joined: Tue Mar 09, 2010 4:03 pm
Location: Central North America


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 10 guests

cron