Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

How do I add Javascript?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-11-2008, 08:31 AM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default 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?
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #2  
Old 07-11-2008, 10:03 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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}
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote

The following user thanks balinor for this useful post:
koz (11-10-2009)
  #3  
Old 07-11-2008, 01:01 PM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default Re: How do I add Javascript?

Awesome, worked great. Thanks!
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #4  
Old 07-11-2008, 03:55 PM
  PengHead007's Avatar 
PengHead007 PengHead007 is offline
 

Member
  
Join Date: Dec 2007
Location: Virginia Beach
Posts: 23
 

Default 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.
__________________
X-cart Gold v4.1.9

Thanks,
PengHead007
Reply With Quote
  #5  
Old 07-11-2008, 04:14 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #6  
Old 07-14-2008, 11:21 AM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default 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?
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #7  
Old 07-31-2008, 11:42 AM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default 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?
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #8  
Old 07-31-2008, 12:02 PM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default 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>">
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #9  
Old 07-31-2008, 12:06 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default 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?
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #10  
Old 07-31-2008, 12:14 PM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default 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.
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:25 AM.

   

 
X-Cart forums © 2001-2020