Jump to content

Adding Javascript To My Cubecart 5 Site


jaded

Recommended Posts

Hi

 

I wanted to add a simple javascript code to my site so that I could add a live chat. I have the code, but seem unable to see how to add it and get it to work.

 

I know that the code is supposed to be between the <head> and </head> tags.

 

My questions are

 

What file would I add this code to so that the live chat shows on ALL pages in case someone needs something?

How do I add the javascript?

Do I have to convert it to php?

Since there are no /tpl files anymore, I am kind of stumped.

 

 

If it helps, I am using the mircan skin.

 

I really need to be able to get this to work. I would appreciate as much help as possible.

 

This is the code that I am trying to use

<!--Start of Zopim Live Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
$.src='//v2.zopim.com/?23a3vfhoiJInNIPU5rCZHspQwctRJbGv';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
</script>
<!--End of Zopim Live Chat Script-->
Link to comment
Share on other sites

Welcome jaded! Glad to see you made it to the forums.

 

The template file you are wanting is /skins//YOUR_SKIN/templates/main.php (even though it ends in .php, it is really HTML and Smarty markup).

 

Smarty, the template engine, uses for itself anything between braces without whitespace. That means:

{some javascript code} will not work

{ some javascript code } will work because whitespace is next to the braces.

 

If you have a lot of javascript, you can do this:

{literal}<!-- Start of --><script>{lots}{of}{tight}{javascript}{code}</script><!-- End -->{/literal}

All that is nested within {literal}{/literal} tags is ignored by Smarty.

Link to comment
Share on other sites

Welcome jaded! Glad to see you made it to the forums.

 

The template file you are wanting is /skins//YOUR_SKIN/templates/main.php (even though it ends in .php, it is really HTML and Smarty markup).

 

Smarty, the template engine, uses for itself anything between braces without whitespace. That means:

{some javascript code} will not work

{ some javascript code } will work because whitespace is next to the braces.

 

If you have a lot of javascript, you can do this:

{literal}<!-- Start of --><script>{lots}{of}{tight}{javascript}{code}</script><!-- End -->{/literal}

All that is nested within {literal}{/literal} tags is ignored by Smarty.

You know, I truly appreciate that.

 

I was trying to put it in that file. That's what made sense to me.

 

I did not know about the LITERAL tags and that did the trick!

 

You are a Godsend. Thank you so much and have a truly wonderful Easter!!

Link to comment
Share on other sites

Hi

A much easier solution would have been to download and activate our free Zopim plugin '?do=embed' frameborder='0' data-embedContent>> when all you have to do is enter your site id - there are no code changes to any files and also no chance of your change being over written when doing an upgrade

Thanks

Ian

Link to comment
Share on other sites

Hi

A much easier solution would have been to download and activate our free Zopim plugin '?do=embed' frameborder='0' data-embedContent>> when all you have to do is enter your site id - there are no code changes to any files and also no chance of your change being over written when doing an upgrade

Thanks

Ian

Hi Ian, I did try that. I found that original post when first looking for a better  live chat to use. When you click the link and go to to Zopim site, you see the yellow/orange block that reads "Zopim Plugin". You click that and all that's available is  I even chatted live on the Zopim site and the woman that was chatting with me had no clue how to help me get Zopim to work. That's when I came here to get some help.

 

So, I just went through it again and found that I'd missed the small test word in the description scrolling down the page to "click here". I did that. It's really quite a process to receive the plugin. I had to sign up and register for a hosting account. Now I need to wait for the service to be approved as it's pending. I do appreciate the plugin and appreciate it's free, but it's complicated and easy to miss just how exactly to get the plugin. As stated, the support person on your site yesterday did not even know how to direct me to the plugin or how to get Zopim on my Cubecart site.

 

At any rate, I am appreciative of your reply. I did find it with my third look after your post. Hopefully I'll be able to download it soon as I don't know how long it will remain as a "pending" order. It's a terrific service and I do truly appreciate that you're offering it!

 

Thanks so much !

Link to comment
Share on other sites

Hi

 

Your order has already been approved but as it is a free module that isnt necessary anyway and the product would have been available immediately via your Havenswift Hosting account.  Yes you need to sign up for an account purely as all of our downloads are done securely through our website but certainly not for a hosting account (of course if you want to migrate your hosting over to us and receive free CubeCart support, very quick hosting servers etc then we would be more than happy to do that for you :D )

 

Good luck with the plugin !

 

Ian 

Link to comment
Share on other sites

Hi

 

Your order has already been approved but as it is a free module that isnt necessary anyway and the product would have been available immediately via your Havenswift Hosting account.  Yes you need to sign up for an account purely as all of our downloads are done securely through our website but certainly not for a hosting account (of course if you want to migrate your hosting over to us and receive free CubeCart support, very quick hosting servers etc then we would be more than happy to do that for you :D )

 

Good luck with the plugin !

 

Ian 

Hi and thank you, Ian. Where can I find my "site ID"? Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...