updatePrice
This commit is contained in:
parent
a96a6037ab
commit
bde9585919
@ -1,4 +1,5 @@
|
|||||||
$(function(){
|
$(function(){
|
||||||
|
/*
|
||||||
$('.configurator-opt-change').on('change', function(e) {
|
$('.configurator-opt-change').on('change', function(e) {
|
||||||
$.post($(this).data('url'), $('form#buy_block').serialize(), function (data) {
|
$.post($(this).data('url'), $('form#buy_block').serialize(), function (data) {
|
||||||
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
|
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
|
||||||
@ -9,6 +10,14 @@ $(function(){
|
|||||||
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
|
$('span#our_price_display').replaceWith('<span id="our_price_display" class="price" itemprop="price" content="'+data.price+'">'+data.priceDisplay+'</span>');
|
||||||
}, 'json').fail(function(){});
|
}, '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-datepicker').datepicker({dateFormat: "dd/mm/yy"});
|
||||||
$('.configurator-opt-file').fileupload({
|
$('.configurator-opt-file').fileupload({
|
||||||
@ -34,7 +43,6 @@ $(function(){
|
|||||||
for (var i=0; i<inputElems.length; i++) {
|
for (var i=0; i<inputElems.length; i++) {
|
||||||
if (inputElems[i].type === "checkbox" && inputElems[i].checked === true){
|
if (inputElems[i].type === "checkbox" && inputElems[i].checked === true){
|
||||||
count++;
|
count++;
|
||||||
console.log(count);
|
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
$(this).prop('checked', false);
|
$(this).prop('checked', false);
|
||||||
$(this).parent().removeClass('checked');
|
$(this).parent().removeClass('checked');
|
||||||
@ -49,7 +57,6 @@ $(function(){
|
|||||||
for (var i=0; i<inputElems.length; i++) {
|
for (var i=0; i<inputElems.length; i++) {
|
||||||
if (inputElems[i].type === "checkbox" && inputElems[i].checked === true){
|
if (inputElems[i].type === "checkbox" && inputElems[i].checked === true){
|
||||||
count++;
|
count++;
|
||||||
console.log(count);
|
|
||||||
if (count > 2) {
|
if (count > 2) {
|
||||||
$(this).prop('checked', false);
|
$(this).prop('checked', false);
|
||||||
$(this).parent().removeClass('checked');
|
$(this).parent().removeClass('checked');
|
||||||
|
@ -705,7 +705,6 @@ function updatePrice()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Apply Tax if necessary
|
// Apply Tax if necessary
|
||||||
if (noTaxForThisProduct || customerGroupWithoutTax)
|
if (noTaxForThisProduct || customerGroupWithoutTax)
|
||||||
{
|
{
|
||||||
@ -766,6 +765,20 @@ function updatePrice()
|
|||||||
unit_price = priceWithDiscountsDisplay / productUnitPriceRatio;
|
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 */
|
/* Update the page content, no price calculation happens after */
|
||||||
|
|
||||||
// Hide everything then show what needs to be shown
|
// Hide everything then show what needs to be shown
|
||||||
|
Loading…
x
Reference in New Issue
Block a user