X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Want to add code in <head> section in X-Cart 5 (https://forum.x-cart.com/showthread.php?t=75034)

Soft-Reseller.com 02-25-2017 10:24 AM

Want to add code in <head> section in X-Cart 5
 
Hello

I am using X-Cart Business V5.3.2.7.
I want to use LiveHelp script who says to add following code in <head></head> section.

Code:

<!--  BEGIN chatstack.com Live Chat HTML Code -->
<script type="text/javascript">
        var Chatstack = { server: 'chat.soft-reseller.com' };
        (function(d, undefined) {
                // JavaScript
                Chatstack.e = []; Chatstack.ready = function (c) { Chatstack.e.push(c); }
                var b = d.createElement('script'); b.type = 'text/javascript'; b.async = true;
                b.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + Chatstack.server + '/livehelp/scripts/js.min.js';
                var s = d.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(b, s);
        })(document);
</script>
<!--  END chatstack.com Live Chat HTML Code -->


Kindly guide me where I put this code.
Best Regards

qualiteam 02-26-2017 10:54 PM

Re: Want to add code in <head> section in X-Cart 5
 
You should create a custom module having the following Twig template:
Code:

{##
 # @ListChild (list="head", weight="5000")
 #}
<!--  BEGIN chatstack.com Live Chat HTML Code -->
<script type="text/javascript">
        var Chatstack = { server: 'chat.soft-reseller.com' };
        (function(d, undefined) {
                // JavaScript
                Chatstack.e = []; Chatstack.ready = function (c) { Chatstack.e.push(c); }
                var b = d.createElement('script'); b.type = 'text/javascript'; b.async = true;
                b.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + Chatstack.server + '/livehelp/scripts/js.min.js';
                var s = d.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(b, s);
        })(document);
</script>
<!--  END chatstack.com Live Chat HTML Code -->


This should add your custom script into the header part of the page.

qualiteam 02-26-2017 11:40 PM

Re: Want to add code in <head> section in X-Cart 5
 
You can also add the code on the "Look & Feel" -> "Custom JavaScript" page (but remove the wrapping "script" tag).
Although in this case the code won't go into the "head" part of the page, it still should work.

lostdog9 01-21-2019 03:36 PM

Re: Want to add code in <head> section in X-Cart 5
 
Hello,

I have used this advice and added the script into the head but it does not seam to render. Does anyone see something wrong here?

<!-- BEGIN schema HTML Code -->
<script src="https://cdn.schemaapp.com/javascript/schemaFunctions.min.js"></script>
<script>schemaLoad("Factory_Direct_Hardware", "YEKJD-0JKCZ-FMEEY-K2LIJ", true);</script>
<script src="https://cdn.schemaapp.com/javascript/highlight.js"></script>
<!-- END schema HTML Code -->

sales@webosusa.com 05-08-2019 04:55 AM

Re: Want to add code in <head> section in X-Cart 5
 
This will sove your issue...
https://market.x-cart.com/addons/custom-header-assets.html


All times are GMT -8. The time now is 02:01 AM.

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