Minicart woes

Questions and answers about ShopSite Custom Templates

Minicart woes

Postby Kapitol » Sat Jul 07, 2012 12:24 pm

This minicart code is driving me crazy. I am not sure what to do. The tutorial says copy the code and place it in the header or footer, but forgets to mention what code to copy.
referring to Step 5.
http://www.shopsite.com/help/10.1/en-US/sc/pro/index.htm?page=/help/10.1/en-US/install/minicart.examples1.html
It's not the JavaScript code because earlier in the document they said to paste that into a file and name it minicart.js
Page i'm trying to get it to show up on,
http://www.artandsoulbeads.com/store/swarovski_crystal_top_drill_bicone_6301.html

Chrome also says their is an Uncaught SyntaxError: Unexpected token
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Minicart woes

Postby Jim » Sat Jul 07, 2012 3:04 pm

in the place in your template where you want the Minicart to display you use the tag [-- MiniCart --] .
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Minicart woes

Postby Kapitol » Sat Jul 07, 2012 4:12 pm

That answer was to simple, but unless I knew or guessed was not easy to find w/o asking.

The instructions also say the cart has to be on the same server in order to work. When I add products to the cart they dont show up in the minicart. I double checked the code and made sure I had the correct url for cartURL, and serial number. I tried 4 different cartURL's and nothing worked.

Which address has to be on the same server? This is what a&sb looks like.
Shopping Cart secure URL: Different url
Secure Store URL: Different url
ShopSite secure URL: Different url
ShopSite Images secure URL: Different url

Store URL: Same url
ShopSite Images URL: Same url
Merchant CGIs URL: Same url
Shopping Cart CGIs URL: Same url
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Minicart woes

Postby Jim » Sat Jul 07, 2012 9:07 pm

The first shopping cart screen url has to match the store page url. In you case it does, www.artandsoulbeads.com for both of them. The Registration screens and checkout screens do not match the store pages though. So the minicart should display on the store pages which is where you would want it anyway.

I noticed that you have a style listed as "minecart" around the javascript include file line. Is that a typo or did you mean to have it say "mine" instead of "mini"?
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Minicart woes

Postby Kapitol » Sun Jul 08, 2012 6:20 am

Jim wrote:I noticed that you have a style listed as "minecart" around the javascript include file line. Is that a typo or did you mean to have it say "mine" instead of "mini"?


:lol: Uh.. let's just pretend it is a typo and not a reference to a game I occasionally play.
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Minicart woes

Postby Kapitol » Wed Jul 18, 2012 1:11 pm

Jim wrote:The first shopping cart screen url has to match the store page url. In you case it does, www.artandsoulbeads.com for both of them. The Registration screens and checkout screens do not match the store pages though. So the minicart should display on the store pages which is where you would want it anyway.


I asked the host to check it out and he said it worked for him. I dont know if he was being truthful because it doesn't seem to be working for me in the Chrome, Firefox, or IE.

I've entered various store id urls, which seems strange, but each one shows the shopping cart page when you click on the mini cart icon. Does having more than 1 url for the store page seem strange?

Code: Select all
http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/order.cgi?storeid=*26768bb6e4b69d422e5a997168a771b73848cd2f17&function=show
and
http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/order.cgi?storeid=*2e79b64368b7b4f7d81ac6ca614e129877fb6e48a68d7c3479&function=show
and
http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/order.cgi?storeid=*28b746a9bc686d40dddb6fb746a2791b1348def88737&function=show
and
http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/order.cgi?storeid=*28b776a9bc686a41bdcbc09746a2791b1348def88703&function=show
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Minicart woes

Postby Jim » Wed Jul 18, 2012 3:52 pm

The storeid changing is normal. Each time a reference to the storeid is generated it will give a different encrypted value, all of which will be decrypted to the same text version. So the links you posted could very well be to the same store. The value of the encryption is that someone can't decipher out what your storeid is. This is particularly helpful on stores on Windows servers where the storeid is the actual Windows user name.

As long as the value was generated by ShopSite you can use any of them in a location where you need the storeid. You could also just use the text version of the storeid if you leave off the * at the start, so instead of "storeid=*26768bb6e4b69d422e5a997168a771b73848cd2f17&function=show" you could use "storeid=jim&function=show" if your storeid was jim.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Minicart woes

Postby Kapitol » Fri Jul 20, 2012 12:32 pm

JS code
Code: Select all
var serialnum="-"; - edited to protect number
var cartURL="http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/order.cgi?storeid=artandsoulbeads&function=show";
var textColor="black";
var backgroundColor="transparent";
var showCart="yes";       // only "yes" or "no"
var cartColor="black";    // only "black" or "white"
var textAlign="left";     // only "left" "right" or "center"


Hosting Service - back office information.
Code: Select all
Product: Pro
Version: 10 sp2 r3.1
Serial Number: - - edited to protect number
Code: 15750002,O

Code: Select all
/**** Mini Cart Subtotal Display ****/

/**** REPLACE THE VALUES IN THESE LINES ****/
var serialnum="-" - edited to protect number
var cartURL="http://www.artandsoulbeads.com/cgi-artandsoulbeads/sb/order.cgi?storeid=artandsoulbeads&function=show";
var textColor="black";
var backgroundColor="transparent";
var showCart="yes";       // only "yes" or "no"
var cartColor="black";    // only "black" or "white"
var textAlign="left";     // only "left" "right" or "center"

/**** DON'T CHANGE ANYTHING BELOW HERE ****/

var linkColor=textColor;
var cookies=document.cookie;  //read in all cookies
var start = cookies.indexOf("ss_cart_" + serialnum + "=");
var cartvalues = "";
var linecount = 0;
var start1;
var end1;
var tmp;

// Start Output
document.write("<div style=\"color:" + textColor + ";");
document.write("background-color:" + backgroundColor + ";");
document.write("text-align:" + textAlign + ";");
document.write("font-family: Verdana, Arial, Helvetica, sans-serif;");
document.write("font-size: 8pt;");
document.write("\">\n");
if (showCart == "yes")
{
  document.write("<a href=\"");
  document.write(cartURL + "\"");
  document.write(">");
  document.write("<img src=\"./media/themesmedia/cart-" + cartColor + ".gif\" border=\"0\" align=\"top\">");
  document.write("</a> ");
}

if (start == -1)  //No cart cookie
{
  document.write("<a href=\"" + cartURL + "\" style=\"color:" + linkColor + "\">");
  document.write("0 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=\"" + cartURL + "\" style=\"color:" + linkColor + "\">");
        document.write(tmp.substring(colon+1,end - start));
        if ((tmp.substring(colon+1,end - start)) == 1 )
        {
          document.write(" Item");
        }
        else
        {
          document.write(" Items");
        }
        document.write(": ");
      }

      if (linecount == 3)  // Product Subtotal
      {
        tmp = cartvalues.substring(start,end);
        colon = tmp.indexOf(":", 0);
        document.write(tmp.substring(colon+1,end - start));
        document.write("</a>");
      }

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

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

IF you had done everything here and it still wasn't working what would you next move be?

Is it up to the host to jump in a help at this point or do I hire a real developer to help figure out why the store ID and URL isn't working? I copied the JavaScript straight off the shopsite website.
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Minicart woes

Postby loren_d_c » Fri Jul 20, 2012 1:08 pm

This may be a silly question, but if you go to your ShopSite's Commerce Setup -> Order System -> Layout Info menu is the 'Mini Shopping Cart' checkbox checked or unchecked? If it is unchecked, then the shopping cart is not even setting the mini-cart cookie for the JavaScript to read on the store pages.

-Loren
loren_d_c
 
Posts: 2569
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Re: Minicart woes

Postby Kapitol » Fri Jul 20, 2012 2:05 pm

uh... I didn't even know that option existed. Thanks for the heads up, Loren DC.
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Minicart woes

Postby Kapitol » Fri Jul 20, 2012 4:34 pm

One last issue. Looks like "Your shopping cart is empty" is missing from the Store text page under Mini Cart. That line however disappears when you remove it from Store Text Shopping Cart. -- I would prefer to just target it's parent element like a <p> tag or something but you guys wrote it without wrapping it in something.

Can you guys help me figure out how that line gets put into the mini cart when your cart is empty? it's missing from the minicart.js -- i would like to wrap it in a paragraph tag.
Kapitol
 
Posts: 52
Joined: Mon May 14, 2012 10:26 pm

Re: Minicart woes

Postby Jim » Fri Jul 20, 2012 9:40 pm

It would be using a template tag, I'm not sure which tag but probably "[-- STORE.SC_YourShoppingCart --]" which is in the Minicart.js file that is in the templates /includes location.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 93 guests