Jump to content

Script won't load in tpl file. What should I do?


Recommended Posts

Hello!

First of all I'm new on the forum, so If I posted this topic to the wrong section then pardon me.

 

The problem. We use prestashop 1.6. We decided to create a small calculator for our customer so they can calculate the price and the quantity of the product. We placed the code in the themes/product.tpl

The code:

{literal}
								<script src="jquery-3.3.1.min.js" type="text/javascript"></script>
								<meta charset="utf-8">
								<script>
								$(function(){
								$("#nm_input").on("change keyup", function(){
								nm			= Number($(this).val());
								nm_egysegar	= Number($("#egysegar").val());
								$("#nm_eredmeny").text(Math.ceil(nm / 2.4) + "db,");
								$("#nm_eredmeny_ar").text(Math.ceil((nm / 2.4 * nm_egysegar)) + "Ft");
								});
								});
								</script>
								Felület: <input type="number" value="0" min="1" step="1" id="nm_input">
								<br>
								ÁR:<span id="nm_eredmeny"></span>&nbsp;<span id="nm_eredmeny_ar"></span>
{/literal}

I tried with and without the literal I read a lot of forum topic where this was the problem with the code. But in my case on the site nothing happens. The site working there is no error or blank page it just won't display.
I'm not sure if I'm missing something from the code because on a simple html site it works. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...