diff --git a/www/themes/chocolatdemariage/js/modules/antadisconfigurator/views/configurator.js b/www/themes/chocolatdemariage/js/modules/antadisconfigurator/views/configurator.js index d14c0a30..3aa47ba6 100644 --- a/www/themes/chocolatdemariage/js/modules/antadisconfigurator/views/configurator.js +++ b/www/themes/chocolatdemariage/js/modules/antadisconfigurator/views/configurator.js @@ -1,4 +1,5 @@ $(function(){ + /* $('.configurator-opt-change').on('change', function(e) { $.post($(this).data('url'), $('form#buy_block').serialize(), function (data) { $('span#our_price_display').replaceWith(''+data.priceDisplay+''); @@ -9,6 +10,14 @@ $(function(){ $('span#our_price_display').replaceWith(''+data.priceDisplay+''); }, 'json').fail(function(){}); }); + */ + + $('.configurator-opt-change').on('change', function(e) { + updatePrice(); + }); + $('.configurator-opt-click').on('click', function(e){ + updatePrice(); + }); $('.configurator-opt-datepicker').datepicker({dateFormat: "dd/mm/yy"}); $('.configurator-opt-file').fileupload({ @@ -34,7 +43,6 @@ $(function(){ for (var i=0; i 1) { $(this).prop('checked', false); $(this).parent().removeClass('checked'); @@ -49,7 +57,6 @@ $(function(){ for (var i=0; i 2) { $(this).prop('checked', false); $(this).parent().removeClass('checked'); diff --git a/www/themes/chocolatdemariage/js/product.js b/www/themes/chocolatdemariage/js/product.js index 40588e3e..e391045d 100644 --- a/www/themes/chocolatdemariage/js/product.js +++ b/www/themes/chocolatdemariage/js/product.js @@ -705,7 +705,6 @@ function updatePrice() } } - // Apply Tax if necessary if (noTaxForThisProduct || customerGroupWithoutTax) { @@ -764,8 +763,22 @@ function updatePrice() } else unit_price = priceWithDiscountsDisplay / productUnitPriceRatio; - } - + } + + var forfaitAlreadyAdd = false + $('input[data-price]').each(function() { + if ($(this).attr('type') === "checkbox" && $(this).prop('checked') === true) { + if ($(this).attr('id').substr(0,7) == 'PARFUMS') { + if (forfaitAlreadyAdd === false) { + priceWithDiscountsDisplay = priceWithDiscountsDisplay + parseFloat($(this).data('price')); + forfaitAlreadyAdd = true; + } + } else { + priceWithDiscountsDisplay = priceWithDiscountsDisplay + parseFloat($(this).data('price')); + } + } + }); + /* Update the page content, no price calculation happens after */ // Hide everything then show what needs to be shown