L
L
Lev Rozanov2016-12-04 11:52:47
JavaScript
Lev Rozanov, 2016-12-04 11:52:47

Why does the script count the number of products through one?

Good day!

There is an online store magazin.molecularmeal.ru/
On any product page, for example magazin.molecularmeal.ru/nabor-tekstur-po-molekuljarnoj-kuhne, if you click on the "plus" in the quantity of the product, then the quantity is added after one, just the same and diminishes.

The same thing happens if you enter the quantity manually and try to increase or decrease.

In the script file (/catalog/view/javascript/common.js) the addition looks like this:

$(".quantity-adder .add-action").click(function(){
  if($(this).hasClass('add-up')){
    $("[name=quantity]",'.quantity-adder').val(parseInt($("[name=quantity]",'.quantity-adder').val())+1);
  } else {
    if(parseInt($("[name=quantity]",'.quantity-adder').val())>1){
      $("input",'.quantity-adder').val(parseInt($("[name=quantity]",'.quantity-adder').val())-1);
    }
  }
});


How to be? Where do I need to fix it so that the quantity of goods is considered normal?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2016-12-04
@MetisKot

You have 2 scripts
catalog/view/javascript/common.js and catalog/view/theme/megashop/javascript/common.js connected there
And both have code for +\- , obviously, and it works 2 times.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question