Skip to content

Commit

Permalink
Merge pull request #398 from Invizo/develop
Browse files Browse the repository at this point in the history
Merge Develop with Master
  • Loading branch information
code-with-mehedi authored Mar 18, 2024
2 parents 6430488 + 4116f48 commit b6c3936
Show file tree
Hide file tree
Showing 86 changed files with 36,316 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: storegrowth-sales-booster
VERSION: 1.25.7
VERSION: 1.26.7
33 changes: 22 additions & 11 deletions Includes/Modules/CountdownTimer/assets/scripts/custom.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
'use strict';
"use strict";

jQuery(document).ready( function($) {
jQuery(document).ready(function ($) {
sgsb_countdown_timer_methods();
});

$('.sgsb-countdown-timer-items').each(function() {
$(this).countdown( $(this).data('end-date') )
.on('update.countdown', function(event) {
$(this).find('strong.sgsb-countdown-timer-item-days').html(event.strftime('%D'));
$(this).find('strong.sgsb-countdown-timer-item-hours').html(event.strftime('%H'));
$(this).find('strong.sgsb-countdown-timer-item-minutes').html(event.strftime('%M'));
$(this).find('strong.sgsb-countdown-timer-item-seconds').html(event.strftime('%S'));
function sgsb_countdown_timer_methods() {
jQuery(".sgsb-countdown-timer-items").each(function () {
jQuery(this)
.countdown(jQuery(this).data("end-date"))
.on("update.countdown", function (event) {
jQuery(this)
.find("strong.sgsb-countdown-timer-item-days")
.html(event.strftime("%D"));
jQuery(this)
.find("strong.sgsb-countdown-timer-item-hours")
.html(event.strftime("%H"));
jQuery(this)
.find("strong.sgsb-countdown-timer-item-minutes")
.html(event.strftime("%M"));
jQuery(this)
.find("strong.sgsb-countdown-timer-item-seconds")
.html(event.strftime("%S"));
});
});

} );
}
52 changes: 43 additions & 9 deletions Includes/Modules/DirectCheckout/assets/js/sgsb-dc-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@

const directCheckOut = {
init: function () {
$( '.product' ).on( 'click', '.sgsb_buy_now_button, .sgsb_buy_now_button_product_page', this.handleProductDirectCheckout );
jQuery( '.product' ).on( 'click', '.sgsb_buy_now_button, .sgsb_buy_now_button_product_page', this.handleProductDirectCheckout );
},

handleProductDirectCheckout: function( event ) {
event.stopPropagation();
event.preventDefault();

// Check quick cart checkout availability first.
if ( sgsbDcFrontend?.isPro && sgsbDcFrontend?.isQuickCartCheckout ) return;

let productId = $( event?.target ).data( 'id' ),
let productId = jQuery( event?.target ).data( 'id' ),
checkOutUrl = event?.target?.href;

// Collect data id from product id.
productId = typeof productId === 'undefined' ? $( event?.target ).data( 'product_id' ) : productId;

productId = typeof productId === 'undefined' ? jQuery( event?.target ).data( 'product_id' ) : productId;
jQuery.ajax({
url : sgsbDcFrontend?.ajax_url,
type : 'POST',
Expand All @@ -36,9 +35,44 @@
});
},
};

// For sidebar.
jQuery(document).ready(function () {
directCheckOut.init();
});
})(jQuery);


const sgsbDirectChecoutQuick = {
init: function () {
jQuery( '.product' ).on( 'click', '.sgsb_buy_now_button, .sgsb_buy_now_button_product_page', this.handleProductDirectCheckout );
},

handleProductDirectCheckout: function( event ) {
event.stopPropagation();
event.preventDefault();

// Check quick cart checkout availability first.
let productId = jQuery( event?.target ).data( 'id' ),
checkOutUrl = event?.target?.href;

// Collect data id from product id.
productId = typeof productId === 'undefined' ? jQuery( event?.target ).data( 'product_id' ) : productId;

jQuery.ajax({
url : sgsbDcFrontend?.ajax_url,
type : 'POST',
data : {
'action' : 'woocommerce_add_to_cart',
'product_id' : productId,
},
success : ( response ) => {
console.log( response?.cart_hash );
// if ( response?.cart_hash ) {
window.location.href = checkOutUrl;
// }
},
error : ( error ) => console.log( error )
});
},
};
99 changes: 50 additions & 49 deletions Includes/Modules/FlyCart/assets/js/wfc-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,7 @@
$notificationPopup.fadeIn().delay(2500).fadeOut();
}

/**
* Set Fly Cart Contents.
*/
function setCartContents(response) {
let parentElement = $(".sgsb-widget-shopping-cart-content");
parentElement.html(response?.data?.htmlResponse);
$(".wfc-cart-icon .wfc-cart-countlocation, .wfc-widget-sidebar .wfc-cart-countlocation").html(
response?.data?.cartCountLocation
);
elementClassRemover();
setTimeout(function () {
$(".sgsb-fly-cart-loader").addClass("wfc-hide");
}, 500);

jQuery(document.body).trigger("wc_fragment_refresh");
}

function elementClassRemover() {
let parentElement = $(".sgsb-widget-shopping-cart-content");
let cartCollatoralClass = $(".sgsb-cart-collaterals");
let cartFormElement = $("form.sgsb-woocommerce-cart-form");

if (parentElement.length > 0) {
parentElement
.find("div.kadence-woo-cart-form-wrap")
.removeClass("kadence-woo-cart-form-wrap");
}
if (cartFormElement.length > 0) {
cartFormElement.find("div.cart-summary").remove();
cartFormElement
.find(".woocommerce-content-box")
.find("h2")
.remove()
.end()
.removeClass("woocommerce-content-box full-width clearfix");
}

if (cartCollatoralClass.length > 0) {
cartCollatoralClass.find(".shipping-coupon").remove();
cartCollatoralClass
.find(".cart_totals")
.find(".wc-proceed-to-checkout a:not(.sgsb-cart-widget-buttons a)")
.remove();
}
}

/**
* Get Cart Contents.
*/
Expand All @@ -76,7 +32,7 @@
_ajax_nonce: sgsbFrontend.nonce,
method: "get_cart_contents",
},
success: setCartContents,
success: sgsbFlyCartSetContents,
});
}

Expand Down Expand Up @@ -210,7 +166,7 @@
url: event.target.action,
method: "POST",
data: $(this).serialize(),
success: setCartContents,
success: sgsbFlyCartSetContents,
});
}
);
Expand All @@ -223,7 +179,6 @@
var quantityInput = $(this).siblings(".quantity").find(".qty");
var maxValue = quantityInput.attr("max");
var currentValue = parseInt(quantityInput.val());
console.log(maxValue);
if (
maxValue !== "" &&
!isNaN(currentValue) &&
Expand Down Expand Up @@ -294,7 +249,7 @@
$.ajax({
url: $(this).attr("href"),
method: "GET",
success: setCartContents,
success: sgsbFlyCartSetContents,
});
}
);
Expand Down Expand Up @@ -369,3 +324,49 @@
}
});
})(jQuery);

/**
* Set Fly Cart Contents.
*/
function sgsbFlyCartSetContents(response) {
let parentElement = jQuery(".sgsb-widget-shopping-cart-content");
parentElement.html(response?.data?.htmlResponse);
jQuery(".wfc-cart-icon .wfc-cart-countlocation, .wfc-widget-sidebar .wfc-cart-countlocation").html(
response?.data?.cartCountLocation
);
sgsbFlyCartElementClassRemover();
setTimeout(function () {
jQuery(".sgsb-fly-cart-loader").addClass("wfc-hide");
}, 500);

jQuery(document.body).trigger("wc_fragment_refresh");
}

function sgsbFlyCartElementClassRemover() {
let parentElement = jQuery(".sgsb-widget-shopping-cart-content");
let cartCollatoralClass = jQuery(".sgsb-cart-collaterals");
let cartFormElement = jQuery("form.sgsb-woocommerce-cart-form");

if (parentElement.length > 0) {
parentElement
.find("div.kadence-woo-cart-form-wrap")
.removeClass("kadence-woo-cart-form-wrap");
}
if (cartFormElement.length > 0) {
cartFormElement.find("div.cart-summary").remove();
cartFormElement
.find(".woocommerce-content-box")
.find("h2")
.remove()
.end()
.removeClass("woocommerce-content-box full-width clearfix");
}

if (cartCollatoralClass.length > 0) {
cartCollatoralClass.find(".shipping-coupon").remove();
cartCollatoralClass
.find(".cart_totals")
.find(".wc-proceed-to-checkout a:not(.sgsb-cart-widget-buttons a)")
.remove();
}
}
Loading

0 comments on commit b6c3936

Please sign in to comment.