0

I have this code (in file footer.tpl) that is supposed to load a js file to a product page.

{if $page.page_name == 'product'}<script type="text/javascript" src="https://zapakowania.pl/themes/zapakowania1/assets/jss/bottom-d68634775.js"></script>{/if}

But presta loads the file from a completely different location and there is an error: prestashop is not defined. What's going on?

I checked other .tpl files and there is no path to the .js file except footer.tpl in any of them

I expect another file to be uploaded to the product page. NOT AN ADDITIONAL JUST ANOTHER

afqedart
  • 11
  • 1

1 Answers1

0

You probably use something inside your bottom-d68634775.js that requires prestashop object to be available. It's not PrestaShop fault. You should execute your code after DOM has been loaded, or you need to consider a different strategy. Maybe instead of loading the whole script again, it would be better to have a similar condition directly inside the javascript code...?

Krystian Podemski
  • 1,375
  • 1
  • 8
  • 12