promotion 1.0

This commit is contained in:
Kevin Adametz 2021-12-25 02:51:22 +01:00
parent 1cc8e025a1
commit 570d428b1c
60 changed files with 1596 additions and 272 deletions

View file

@ -251,7 +251,7 @@ label .required {
transition: box-shadow 0.4s ease;
position: relative;
background-color: #fafafa;
padding: 30px 30px 40px;
padding: 30px 20px 40px;
}
.checkout-order:before {

View file

@ -77,7 +77,6 @@ var IqPromotionCart = {
tempData.push({product_id: $(this).data('product-id'), qty: $(this).val()});
}
});
data.action = $(_self.table).data('action');
data.user_promotion_id = $(_self.table).data('user_promotion_id');
data.products = tempData;
@ -89,11 +88,15 @@ var IqPromotionCart = {
update_poduct_price: function(){
console.log("s");
var _self = this;
$('.calculate_product_qty_price').each(function(){
var qty = _self.checkNumber($(_self.table).find('#'+$(this).data('qty-id')).val());;
$('.calculate_product_qty_price_total').each(function(){
var admin_product_id = $(this).data('admin_product_id');
var price = $(this).data('price');
var total = price*qty;
var total = 0;
if($('#product_check_' + admin_product_id).is(':checked')){
var qty = _self.checkNumber($(_self.table).find('#product_qty_' + admin_product_id).val());;
var total = price*qty;
}
$(this).html(total.toFixed(2).replace('.', ','))
});
},

View file

@ -17,8 +17,10 @@ var IqPromotionShopCart = {
url: null,
action: null,
cart_holder: '#promotion_cart_holder',
invoice_holder: '#invoice_details_holder',
checkout_holder: '#promotion_checkout_holder',
free_poduct_id: null,
free_product_id: null,
shipping_option: null,
@ -77,9 +79,9 @@ var IqPromotionShopCart = {
switchFreeProduct: function(_ele){
var _self = this;
if(_ele.prop('checked')){
if(_self.free_poduct_id != _ele.val()){
_self.free_poduct_id = _ele.val();
_self.performRequest({free_poduct_id: _self.free_poduct_id, action: 'switch-free-product'})
if(_self.free_product_id != _ele.val()){
_self.free_product_id = _ele.val();
_self.performRequest({free_product_id: _self.free_product_id, product_id: _ele.data('product_id'), action: 'switch-free-product'})
.done(_self.refreshItemsAndView);
}
}
@ -119,12 +121,21 @@ var IqPromotionShopCart = {
var qty = data.response.qty > 0 ? "x"+data.response.qty : 0;
$('#badge_cart_indicator_'+data.response.product_id).html(qty);
}
$(_self.cart_holder).html(data.html);
if(data.cart){
$(_self.cart_holder).html(data.cart);
}
if(data.invoice){
$(_self.invoice_holder).html(data.invoice);
}
if(data.checkout){
$(_self.checkout_holder).html(data.checkout);
}
_self.showInit();
},
performRequest : function(data) {
var _self = this;
var url = _self.url;
data.perform = true;
_log(data);
// _log(url);
return $.ajax({