Jump to content

Update price on product page when qty value changed


DiffuSer

Recommended Posts

Does anyone faced with the realization of this task? I tried to update to finalize product.js prices, as well as the choice of combinations, but i am too bad versed in the code Prestashop. Someone help me plz.

Link to comment
Share on other sites

  • 3 months later...

I just modify the updateDisplay function this way :

 

$('#our_price_display').text(formatCurrency(productPrice * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank));

 

and

 

$('#old_price_display').text(formatCurrency(productPriceWithoutReduction * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank));

 

and added this test on the function's top

 

if(!isInt($('#quantity_wanted').val()) || $('#quantity_wanted').val()<=0){ $('#quantity_wanted').val(1)}

 

isInt look like this :

function isInt(x) {  var y=parseInt(x);  if (isNaN(y)) return false;  return x==y && x.toString()==y.toString();}

 

 

it work great for me.

Link to comment
Share on other sites

  • 6 months later...

I just modify the updateDisplay function this way :

$('#our_price_display').text(formatCurrency(productPrice * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank));

and

$('#old_price_display').text(formatCurrency(productPriceWithoutReduction * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank));

and added this test on the function's top

if(!isInt($('#quantity_wanted').val()) || $('#quantity_wanted').val()<=0)
{
 $('#quantity_wanted').val(1)
}

isInt look like this :

function isInt(x) {
  var y=parseInt(x);
  if (isNaN(y)) return false;
  return x==y && x.toString()==y.toString();
}

 

it work great for me.

 

Hi!

 

In which file / folder can i find updateDisplay?

 

 

Br,

Tobias

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...