B
B
B0baFeet2016-11-03 17:22:41
JavaScript
B0baFeet, 2016-11-03 17:22:41

js. How to increase the price of a product depending on its quantity?

In general situations, there is a product, they have prices and quantity of goods, therefore 1 product = price of 1 product * per quantity. And so is the total sum of all goods. I'm not able to implement the price cheat, the quantity counter works. Please tell me how to implement, that's what is now available.

$(document).ready(function () {
                    var quantity = parseInt(<?=$arItem['QUANTITY']?>);
                    $('.minus').click(function () {
                        var price = parseInt(<?=$arItem['PRICE']?>);
                        var sum = price * quantity;
                        var count = sum - price;
                        count = count > price ? count : price;
                        $('#sum_<?= $arItem["ID"] ?>').html(count);
                        return false;
                    });
                });

Actually one step down does and no longer reduces.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VA_ic2b, 2016-11-03
@VA_ic2b

$( document).on( "click", ".minus", function() { ... }
Read more - api.jquery.com/on

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question