Peeter
Peeter

Reputation: 199

Prestashop 1.6 - Syntax error when adding Facebook Pixel to the HEAD section

PrestaShop v1.6.1.10

I have a problem adding Facebook pixel code to my PS header. Adding the pixel causes a fatal error. There is a syntax problem... it looks like this:

Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "/shop/themes/default-bootstrap/header.tpl" on line 86 "{if(f.fbq)return;n=f.fbq=function(){n.callMethod?" - Unexpected ".", expected one of: "","" , ")" <-- thrown in /shop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 86

I tried disabling HTLM minifer, clearing the cache, etc. Nothing helps. I think the code compiler can't understand this new Facebook pixel syntax or something. Any ideas on how to fix this?

Upvotes: 0

Views: 303

Answers (1)

gennaris
gennaris

Reputation: 1622

If you are inserting "pure" HTML / Javascript inside a Prestashop smarty (.TPL) file, you'll need to wrap your code between

{literal} your code here {/literal} 

tags.

Keep in mind that this is not the "Prestashop way" to achieve your task, you should consider build a simple module to insert your code through a front display hook.

Upvotes: 1

Related Questions