carlroger Posted January 4, 2017 Share Posted January 4, 2017 Hi, I have two cart rules: 10% off when ordering 15 pcs. and 20% off ordering 30 pcs. All my products have several attributes that increase the price. When I choose 15 or 30 pcs. with the standard product without selected attributes, the price is calculated correctly. But if I choose an attribute, the price is still calculated as if no attribute is chosen. How do I fix this? IMO this is a very critical bug. /Carl Link to comment Share on other sites More sharing options...
NemoPS Posted January 4, 2017 Share Posted January 4, 2017 Core bug, it's addressed in my tut here: http://nemops.com/update-price-on-quantity-change-in-prestashop-1-6/#.WGzh3fnaeUk Link to comment Share on other sites More sharing options...
carlroger Posted January 4, 2017 Author Share Posted January 4, 2017 Core bug, it's addressed in my tut here: http://nemops.com/update-price-on-quantity-change-in-prestashop-1-6/#.WGzh3fnaeUk Very good but I'm experiencing another problem now. When I reach the discount amount, the price increases. In product.js, I added this: $('#our_price_display').text(formatCurrency(priceWithDiscountsDisplay * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank)).trigger('change'); and this: var combID = $('#idCombination').val(); var combination = combinationsFromController[combID]; if(typeof(combination) != 'undefined') { // check if we need to subtract a % from the combo price if($(this).data('discount-type') == 'percentage') { var comboImpact = combination.price - (combination.price / 100 * $(this).data('discount')); } else { var comboImpact = combination.price; } newPrice = formatCurrency(($(this).data('discount-myvalue') + comboImpact) * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank); } And in product.tpl: <tr id="quantityDiscount_{$quantity_discount.id_product_attribute}" class="quantityDiscount_{$quantity_discount.id_product_attribute}" data-real-discount-value="{convertPrice price = $realDiscountPrice}" data-discount-myvalue="{$realDiscountPrice}" data-discount-type="{$quantity_discount.reduction_type}" data-discount="{$quantity_discount.real_value|floatval}" data-discount-quantity="{$quantity_discount.quantity|intval}"> What am I doing wrong? Link to comment Share on other sites More sharing options...
carlroger Posted January 4, 2017 Author Share Posted January 4, 2017 Went over the code again and it's probably because I don't have a base price of the products. All the prices are defined by the attributes. If I change the last line (newPrice) to this, then it works: newPrice = formatCurrency(comboImpact * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank); Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now