01 2022 Microsite Promotion
This commit is contained in:
parent
3f1fb9377d
commit
38e7fd504a
39 changed files with 761 additions and 336 deletions
|
|
@ -19,11 +19,13 @@ var IqPromotionShopCart = {
|
|||
cart_holder: '#promotion_cart_holder',
|
||||
invoice_holder: '#invoice_details_holder',
|
||||
checkout_holder: '#promotion_checkout_holder',
|
||||
show_products_holder: '#show_products_holder',
|
||||
|
||||
|
||||
free_product_id: null,
|
||||
shipping_option: null,
|
||||
show_products_option: null,
|
||||
|
||||
|
||||
init: function () {
|
||||
var _self = this;
|
||||
_self.url = $('input[name=load_url]').val();
|
||||
|
|
@ -47,8 +49,12 @@ var IqPromotionShopCart = {
|
|||
event.preventDefault();
|
||||
_self.switchShipping($(this));
|
||||
});
|
||||
_self.showInit();
|
||||
|
||||
$('select[name=show_products_filter]').on('change', function(event){
|
||||
event.preventDefault();
|
||||
_self.switchShowProducts($(this));
|
||||
});
|
||||
_self.showInit();
|
||||
|
||||
/*$_self.update_poduct_price();*/
|
||||
|
||||
|
|
@ -69,12 +75,22 @@ var IqPromotionShopCart = {
|
|||
_self.performRequest({product_id: $(this).data('product-id'), qty: 0, action: 'remove-shop-product'})
|
||||
.done(_self.refreshItemsAndView);
|
||||
});
|
||||
$('#shipping_state').on('change', function(){
|
||||
if ($('#shipping_address_switch').is(':checked')) {
|
||||
_self.changeStateShipping($(this).val());
|
||||
}
|
||||
});
|
||||
$('#billing_state').on('change', function(){
|
||||
if (!$('#shipping_address_switch').is(':checked')) {
|
||||
_self.changeStateShipping($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
switchShipping: function(_ele){
|
||||
changeStateShipping: function(_state_id){
|
||||
var _self = this;
|
||||
_self.shipping_option = _ele.val();
|
||||
_self.performRequest({shipping_option: _self.shipping_option, action: 'switch-shipping'})
|
||||
.done(_self.refreshItemsAndView);
|
||||
_self.performRequest({shipping_country_id: _state_id, action: 'change-state-shipping'})
|
||||
.done(_self.refreshItemsAndView);
|
||||
},
|
||||
switchFreeProduct: function(_ele){
|
||||
var _self = this;
|
||||
|
|
@ -93,7 +109,28 @@ var IqPromotionShopCart = {
|
|||
.done(_self.refreshItemsAndView);
|
||||
}
|
||||
},
|
||||
|
||||
switchShipping: function(_ele){
|
||||
var _self = this;
|
||||
_self.shipping_option = _ele.val();
|
||||
_self.performRequest({shipping_option: _self.shipping_option, action: 'switch-shipping'})
|
||||
.done(_self.refreshItemsAndView);
|
||||
},
|
||||
switchShowProducts: function(_ele){
|
||||
var _self = this;
|
||||
_self.show_products_option = _ele.val();
|
||||
_self.performRequest({show_products_option: _self.show_products_option, action: 'switch-show_products'})
|
||||
.done(_self.refreshShowProducts);
|
||||
},
|
||||
refreshShowProducts: function (data){
|
||||
var _self = IqPromotionShopCart;
|
||||
if(data.shop_products_view){
|
||||
$(_self.show_products_holder).html(data.shop_products_view);
|
||||
}
|
||||
$(_self.btn_shop_add).on('click', function(event){
|
||||
event.preventDefault();
|
||||
_self.addShopProduct($(this));
|
||||
});
|
||||
},
|
||||
updateInputCart: function (_ele){
|
||||
var _self = this;
|
||||
var qty = parseInt(_ele.val());
|
||||
|
|
@ -130,6 +167,11 @@ var IqPromotionShopCart = {
|
|||
if(data.checkout){
|
||||
$(_self.checkout_holder).html(data.checkout);
|
||||
}
|
||||
if(data.response.shipping_price_formated){
|
||||
$('#shipping_price_holder').html(data.response.shipping_price_formated);
|
||||
}
|
||||
|
||||
|
||||
_self.showInit();
|
||||
},
|
||||
performRequest : function(data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue