Answer the question
In order to leave comments, you need to log in
How to correctly calculate the total amount?
Hello. Can anyone give me an idea how to correctly calculate the total amount on the product page?
The screenshot shows that the total cost is calculated at the first price, if we order the entire model range, is it possible to somehow take into account the moment that, under some conditions, the total amount should already be calculated at the second price, and so on?
You need at least a direction :)
This is opencart - can someone tell me where to ajax to get this calculation from cms (everything is considered when adding to the cart) - in fact, this is probably the best option?
As a last resort, you can suggest how to transfer all the data (prices - go in a cycle, sizes, price limits) to vue.
I will be immensely grateful to you ...
I will add a bit of code that I use.
This is getting the price at which we consider:
if ( sum <= firstFrom) {
return parseInt($('.prices-row').find('.price1').text());
} else if (sum > firstFrom && sum <= secondFrom) {
return parseInt($('.prices-row').find('.price2').text());
} else if (sum > secondFrom && sum <= thirdFrom) {
return parseInt($('.prices-row').find('.price3').text());
} else if (sum >= thirdFrom ) {
return parseInt($('.prices-row').find('.price4').text());
}
$('#buy-all-total').text( currentPrice(sum) * ( parseInt($input.val()) * parseInt($('.prices-top .qty-input').length) ) );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question