X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How do I add Javascript? (https://forum.x-cart.com/showthread.php?t=41047)

Group Imaging 07-11-2008 08:31 AM

How do I add Javascript?
 
I want to create a menu that corresponds to the rest of my site inside of x-cart on in the header. Where do I put the script code for it to affect the info in head.tpl?

balinor 07-11-2008 10:03 AM

Re: How do I add Javascript?
 
You'd need to put JS in the <head> tag which is in customer/home.tpl. You also need to surround most JS with {literal} tags to work:

{literal}
javascript here
{/literal}

Group Imaging 07-11-2008 01:01 PM

Re: How do I add Javascript?
 
Awesome, worked great. Thanks!

PengHead007 07-11-2008 03:55 PM

Re: How do I add Javascript?
 
Adding the script to customer/home.tpl works for all pages (including https) except the cart pages. I can't find where to add the script so my Comodo corner logo appears throughout the checkout process.

balinor 07-11-2008 04:14 PM

Re: How do I add Javascript?
 
If you are using Fast lane Checkout they have their own set of templates in the Modules/Fast Lane folder.

Group Imaging 07-14-2008 11:21 AM

Re: How do I add Javascript?
 
I thought I had this working and went to check it in IE and for some reason it doesn't work. Here is the link to my cart: http://remembermedisplay.com/order/home.php

I can't figure out why it would work fine in Firefox but not in IE. Any suggestions?

boomobile 07-31-2008 11:42 AM

Re: How do I add Javascript?
 
I need to add 2 javascript files, but not sure where to place them, where x-cart calls them, ect...
I'm using a dynamic drive scrolling marquee for the homepage only, so I'm placing the actual marquee code on that template, but what directory should I copy the two files?

Group Imaging 07-31-2008 12:02 PM

Re: How do I add Javascript?
 
It doesn't matter what directory you copy them to. You can create your own directory for them if you want to keep all your 3rd party scripts in a separate folder. You would just have to make sure that where it lists where your code is located, you set it to the directory that you have saved them in. It should look something like this:

Code:

<script language="javascript" src="<script type="text/javascript" src="highslide/highslide.js"></script>">

boomobile 07-31-2008 12:06 PM

Re: How do I add Javascript?
 
GI: I have other JS all in one file (it's big), so I'd like to keep this one separate. So where does the code to direct go? what file? and if I have several different JS file, will I need to adjust that, or just place them all in the same directory?

Group Imaging 07-31-2008 12:14 PM

Re: How do I add Javascript?
 
Think of it as similar to a CSS reference when you have an external style sheet. You put it in the <head> tags (usually I keep mine near the top to find it quickly). So if it's going into your cart you would be looking for the file skin1/customer/home.tpl. As far as I know there isn't a way to designate it only to the first page in x-cart so if you include it in there it will be loaded with every page of x-cart which shouldn't really matter because the function call is what actually references the file.


All times are GMT -8. The time now is 06:59 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.