Minicart icon won't display unless page is in root directory

General ShopSite user discussion

Minicart icon won't display unless page is in root directory

Postby Craigar » Tue Apr 03, 2012 5:22 am

I knew about this problem for a few months, but just got around to fixing it ( we aren't online yet ).It wouldn't even display in Shopsite stock generated templates in the /store directory, nor the .shtml pages I've made. I was looking for errors in my code (like missing brackets, etc..) but none to be found. So I copied the generated page, and my ,shtml pages to our root directory, and they all worked when loaded into Firefox from there (by manually entering the address).

The minicart code has fully resolved addresses with our actual website name, except the actual shopping cart image which resolves to

"./store/media/themesmedia/cart-black.gif"

I suspected maybe the "dot" before forward slash before store i.e. "./store" in the line of code that displays the image was causing our server to ignore the address and that solved the problem! (We use Lexiconn.com as our host, and I think it's a UNIX server). Maybe it's a problem in Firefox rather than our server, but I doubt it.

so in the mincart .js code I removed the dot and now it displays in all my files, no matter where they are.

Here's the unmodified line:
document.write("<img src=\"./store/media/themesmedia/cart-" + cartColor + ".gif\" border=\"0\" align=\"top\">");

Here's the line after removing the dot
document.write("<img src=\"/store/media/themesmedia/cart-" + cartColor + ".gif\" border=\"0\" align=\"top\">");

Before discovering this, I had specified a base address in the head section, and that also solved the problem i.e.

<base href="http://YourSiteName.com/" target="_self" />

which may be a "safer" way to handle this, especially if your nervous about modifiying code in the mincart below the line that says:

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



I thank all of you who have taken time to share your problems and solutions here.

Craig

www.abscomputersouthbay.com
Craigar
 
Posts: 1
Joined: Tue Apr 03, 2012 3:21 am

Re: Minicart icon won't display unless page is in root direc

Postby Jim » Tue Apr 03, 2012 7:10 am

If your store is not working as it is installed then there is a problem with the install. You should contact Lexiconn about this issue, they should be able to get it fixed so you don't have to do a rewrite of code just to make it work.

My guess is that there is a problem with the settings on the Preferences > Hosting Services screen or perhaps with the url in the store's authorization file.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Minicart icon won't display unless page is in root direc

Postby RRG » Sun Jun 03, 2012 1:13 am

I am having a similar issue. I spent a while searching for the field to set the minicart icon like you would with any other button with no luck. I can highlight the cart, and inspect element and can see that shopsite is assigning the /cart-white.gif instead of the black. My site is white. How can I change the color?
RRG
 
Posts: 16
Joined: Tue May 29, 2012 3:44 pm

Re: Minicart icon won't display unless page is in root direc

Postby Jim » Tue Jun 05, 2012 10:06 am

There could be multiple versions of the MiniCart code for different templates. This explaination is from what the 3Column theme is using.

Viewing the source of the MiniCart.js file (from the Custom templates > includes >Publish >Copy Shopsite Publish ) it starts
Code: Select all
function DisplayMiniCart(name,style,icon) {
and a little further down in the code is this section that uses the icon parameter passed to the function to determine which color cart to display.
Code: Select all
if (icon == "white")
  {
    document.write("<a class=\"mini-icon\" [-- IF ANALYTICS_MULTI_DOMAIN --]href=\"javascript:__utmLinker(\'[-- SHOPPING_CART_URL --]\');\"[-- ELSE --]href=\"[-- SHOPPING_CART_URL --]\"[-- END_IF --]><img src=\"[-- IF SC_USE_SECURITY --][-- STORE.SC_Secure_Image_URL --][-- ELSE --][-- OUTPUT_DIRECTORY_URL --][-- END_IF --]/media/themesmedia/cart-white.gif\" border=\"0\" alt=\"cart\" align=\"top\"><\/a> ");
  }
  else
  {
    document.write("<a class=\"mini-icon\" [-- IF ANALYTICS_MULTI_DOMAIN --]href=\"javascript:__utmLinker(\'[-- SHOPPING_CART_URL --]\');\"[-- ELSE --]href=\"[-- SHOPPING_CART_URL --]\"[-- END_IF --]><img src=\"[-- IF SC_USE_SECURITY --][-- STORE.SC_Secure_Image_URL --][-- ELSE --][-- OUTPUT_DIRECTORY_URL --][-- END_IF --]/media/themesmedia/cart-black.gif\" border=\"0\" alt=\"cart\" align=\"top\"><\/a> ");
  }


So to get the black icon you would need to call the minicart using "black" (or really anything but "white") as the last parameter so something like this
Code: Select all
DisplayMiniCart("ss_cart_[-- STORE_Serial_Number --]","Detail","black")

or this
Code: Select all
DisplayMiniCart("ss_cart_[-- STORE_Serial_Number --]","Subtotal","[-- VAR.CartIcon --]");

You might also check if there is a VAR.CartIcon defined in one of your include files since that is what is being used in the above example from the the Multi-Use-Page-Right.sst template file.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 98 guests