Question

Nice to meet you.

I need to insert this code script in head of my site:

<!--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/?235c9KFWkm3tYoMeAbZ8OLwL30ZDDzuD';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
</script>
<!--End of Zopim Live Chat Script-->

But if i add this in index.php i don't add the product in the basket.

I have this error

    Impossible to add the product to the cart.<br/>textStatus: 'parsererror'<br/>errorThrown: 'SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data'<br/>responseText:<br/>{"products":[{"id":141,"link":"http:\/\/herbalife360.com\/home\/141-formula-1.html#\/gusti-0141_vaniglia","quantity":4,"image":"http:\/\/herbalife360.com\/35-home_default\/formula-1.jpg","image_cart":"http:\/\/herbalife360.com\/35-cart_default\/formula-1.jpg","priceByLine":"180,60 \u20ac","name":"Formula 1","price":"180,60 \u20ac","price_float":180.6,"idCombination":1,"idAddressDelivery":8,"is_gift":false,"hasAttributes":true,"attributes":"0141 - VANIGLIA","hasCustomizedDatas":false,"customizedDatas":[]},{"id":4460,"link":"http:\/\/herbalife360.com\/home\/4460-shaker-herbalife.html","quantity":1,"image":"http:\/\/herbalife360.com\/285-home_default\/shaker-herbalife.jpg","image_cart":"http:\/\/herbalife360.com\/285-cart_default\/shaker-herbalife.jpg","priceByLine":"0,00 \u20ac","name":"SHAKER HERBA...","price":"0,00 \u20ac","price_float":0,"idCombination":0,"idAddressDelivery":8,"is_gift":true,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[{"id":2,"name":"PROMO1 : PROMO1","description":"PROMO1","nameDescription":"PROMO1 : PROMO1","code":"","link":"http:\/\/herbalife360.com\/ordine-veloce?deleteDiscount=2","price":"0,00 \u20ac","price_float":0}],"shippingCost":"0,00 \u20ac","shippingCostFloat":0,"wrappingCost":"0,00 \u20ac","nbTotalProducts":5,"total":"180,60 \u20ac","productTotal":"180,60 \u20ac","freeShipping":"0,00 \u20ac","freeShippingFloat":0,"hasError":false,"crossSelling":""}
{literal}
        <!--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/?235c9KFWkm3tYoMeAbZ8OLwL30ZDDzuD';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
</script>
<!--End of Zopim Live Chat Script-->

        {/literal}

I think that because there is two script similar???

Thank u

Was it helpful?

Solution

You must not insert your code in index.php but in themes/your_theme/header.tpl

You can also use this free plugin, which will do it for you: http://mypresta.eu/modules/advertising-and-marketing/zopim-chat-free.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top