Enabled product bundles
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* wcj-ajax-exchange-rates-average.js
|
||||
*
|
||||
* @version 3.2.2
|
||||
* @since 3.2.2
|
||||
*/
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".wcj_grab_average_currency_exchange_rate").click(function(){
|
||||
var input_id = '#'+this.getAttribute('input_id');
|
||||
var data = {
|
||||
'action': 'wcj_ajax_get_exchange_rates_average',
|
||||
'wcj_currency_from': this.getAttribute('currency_from'),
|
||||
'wcj_currency_to': this.getAttribute('currency_to'),
|
||||
'wcj_start_date': this.getAttribute('start_date'),
|
||||
'wcj_end_date': this.getAttribute('end_date'),
|
||||
};
|
||||
jQuery(input_id).prop('readonly', true);
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajax_object.ajax_url,
|
||||
data: data,
|
||||
success: function(response) {
|
||||
if ( 0 != response ) {
|
||||
jQuery(input_id).val(parseFloat(response));
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
jQuery(input_id).prop('readonly', false);
|
||||
},
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* wcj-ajax-exchange-rates.js
|
||||
*
|
||||
* @version 2.6.0
|
||||
*/
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".exchage_rate_button").click(function(){
|
||||
var input_id = '#'+this.getAttribute('multiply_by_field_id');//+' input';
|
||||
var data = {
|
||||
'action': 'wcj_ajax_get_exchange_rates',
|
||||
'wcj_currency_from': this.getAttribute('currency_from'),
|
||||
'wcj_currency_to': this.getAttribute('currency_to')
|
||||
};
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajax_object.ajax_url,
|
||||
data: data,
|
||||
success: function(response) {
|
||||
jQuery(input_id).val(parseFloat(response));
|
||||
},
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* wcj-bookings.
|
||||
*
|
||||
* version 2.8.0
|
||||
* since 2.5.0
|
||||
*/
|
||||
|
||||
var _ajax_object = ajax_object;
|
||||
|
||||
function change_price() {
|
||||
var date_from = jQuery("input[name='wcj_product_bookings_date_from']").val();
|
||||
var date_to = jQuery("input[name='wcj_product_bookings_date_to']").val();
|
||||
var is_variation_ok = true;
|
||||
if ( jQuery(".variations select").length ) {
|
||||
if ( jQuery(".variations select").find(":selected").val() == '' ) {
|
||||
is_variation_ok = false;
|
||||
}
|
||||
}
|
||||
if ( date_from && date_to && is_variation_ok ) {
|
||||
var d1 = new Date(date_from);
|
||||
var d2 = new Date(date_to);
|
||||
var t1 = d1.getTime();
|
||||
var t2 = d2.getTime();
|
||||
if ( t2 > t1 ) {
|
||||
var product_id = jQuery("input[type='hidden'][name='variation_id']").val();
|
||||
if ( ! product_id ) {
|
||||
product_id = _ajax_object.product_id;
|
||||
}
|
||||
var data = {
|
||||
'action': 'price_change',
|
||||
'product_id': product_id,
|
||||
'date_from': date_from,
|
||||
'date_to': date_to
|
||||
};
|
||||
jQuery.post(_ajax_object.ajax_url, data, function(response) {
|
||||
if ( '' != response ) {
|
||||
jQuery("p[class='price']").css("display", "none");
|
||||
jQuery("p[class='price']").after('<p class="price wcj-price-bookings">'+response+'</p>');
|
||||
}
|
||||
});
|
||||
jQuery("div[name='wcj_bookings_message']").css("display", "none");
|
||||
jQuery("div[name='wcj_bookings_message'] p").text('');
|
||||
} else {
|
||||
jQuery("div[name='wcj_bookings_message']").css("display", "block");
|
||||
jQuery("div[name='wcj_bookings_message'] p").text(_ajax_object.wrong_dates_message);
|
||||
jQuery("p[class='price wcj-price-bookings']").css("display", "none");
|
||||
jQuery("p[class='price']").css("display", "block");
|
||||
}
|
||||
} else {
|
||||
jQuery("p[class='price wcj-price-bookings']").css("display", "none");
|
||||
jQuery("p[class='price']").css("display", "block");
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
change_price();
|
||||
jQuery("input[name^='wcj_product_bookings_date_']").each( function () {
|
||||
jQuery(this).change( change_price );
|
||||
});
|
||||
});
|
||||
|
||||
jQuery(document.body).on('change','.variations select',change_price);
|
||||
jQuery(document.body).on('change','input[name="wcj_variations"]',change_price);
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* wcj-cart-customization.
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @todo (maybe) fix when cart is emptied (i.e. after products removed)
|
||||
*/
|
||||
|
||||
jQuery(document).ready( function() {
|
||||
jQuery( "p.return-to-shop a.button.wc-backward" ).each( function() {
|
||||
jQuery(this).text( wcj_cart_customization.return_to_shop_button_text );
|
||||
} );
|
||||
} );
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* wcj-checkout-custom-fields.
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
for (var i = 0, len = wcj_checkout_custom_fields.select2_fields.length; i < len; i++) {
|
||||
jQuery("#"+wcj_checkout_custom_fields.select2_fields[i].field_id).select2({
|
||||
minimumInputLength: wcj_checkout_custom_fields.select2_fields[i].minimumInputLength,
|
||||
maximumInputLength: wcj_checkout_custom_fields.select2_fields[i].maximumInputLength,
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* wcj-checkout.js
|
||||
*/
|
||||
jQuery( function( $ ) {
|
||||
// Define that JavaScript code should be executed in "strict mode"
|
||||
"use strict";
|
||||
// Trigger WooCommerce's `update_checkout` function, when customer changes payment method
|
||||
$('body').on('change', 'input[name="payment_method"]', function() {
|
||||
$('body').trigger('update_checkout');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* wcj-coupons-code-generator.
|
||||
*
|
||||
* @version 3.1.3
|
||||
* @since 3.1.3
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
if ( '' === jQuery("#title").val() ) {
|
||||
var data = {
|
||||
'action': 'wcj_generate_coupon_code',
|
||||
};
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajax_object.ajax_url,
|
||||
data: data,
|
||||
success: function(response) {
|
||||
if ( '' !== response && '' === jQuery("#title").val() ) {
|
||||
jQuery("#title").val(response);
|
||||
jQuery("#title-prompt-text").html('');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* wcj-custom-tabs-yoast-seo.
|
||||
*
|
||||
* @version 3.2.4
|
||||
* @since 3.2.4
|
||||
* @see https://return-true.com/adding-content-to-yoast-seo-analysis-using-yoastseojs/
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var WCJ_Yoast_Plugin = function() {
|
||||
YoastSEO.app.registerPlugin('wcj_yoast_plugin', {status: 'loading'});
|
||||
this.getData();
|
||||
};
|
||||
|
||||
WCJ_Yoast_Plugin.prototype.getData = function() {
|
||||
var _self = this;
|
||||
YoastSEO.app.pluginReady('wcj_yoast_plugin');
|
||||
YoastSEO.app.registerModification('content', $.proxy(_self.getCustomContent, _self), 'wcj_yoast_plugin', 5);
|
||||
};
|
||||
|
||||
WCJ_Yoast_Plugin.prototype.getCustomContent = function (content) {
|
||||
var custom_product_tabs_content = "";
|
||||
jQuery("textarea[id^='wcj_custom_product_tabs_content_local_']").each(function() {
|
||||
custom_product_tabs_content += " " + jQuery(this).val();
|
||||
});
|
||||
return content + custom_product_tabs_content;
|
||||
};
|
||||
|
||||
$(window).on('YoastSEO:ready', function () {
|
||||
new WCJ_Yoast_Plugin();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* wcj-datepicker.
|
||||
*
|
||||
* @version 3.0.0
|
||||
* @todo maybe_exclude_dates: `date.getDate()`, `date.getFullYear()`
|
||||
* @see maybe_exclude_dates: https://stackoverflow.com/questions/501943/can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holid
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("input[display='date']").each( function () {
|
||||
var mindate = jQuery(this).attr("mindate");
|
||||
if (mindate === 'zero') {
|
||||
mindate = 0;
|
||||
}
|
||||
var maxdate = jQuery(this).attr("maxdate");
|
||||
if (maxdate === 'zero') {
|
||||
maxdate = 0;
|
||||
}
|
||||
jQuery(this).datepicker({
|
||||
dateFormat : jQuery(this).attr("dateformat"),
|
||||
minDate : mindate,
|
||||
maxDate : maxdate,
|
||||
firstDay : jQuery(this).attr("firstday"),
|
||||
changeYear: jQuery(this).attr("changeyear"),
|
||||
yearRange: jQuery(this).attr("yearrange"),
|
||||
beforeShowDay: maybe_exclude_dates,
|
||||
});
|
||||
function maybe_exclude_dates(date){
|
||||
var exclude_days = jQuery(this).attr("excludedays");
|
||||
if (typeof exclude_days !== typeof undefined && exclude_days !== false) {
|
||||
var day = date.getDay();
|
||||
for (var i = 0; i < exclude_days.length; i++) {
|
||||
if (day == exclude_days[i]) {
|
||||
return [false];
|
||||
}
|
||||
}
|
||||
}
|
||||
var exclude_months = jQuery(this).attr("excludemonths");
|
||||
if (typeof exclude_months !== typeof undefined && exclude_months !== false) {
|
||||
var month = date.getMonth() + 1;
|
||||
for (var i = 0; i < exclude_months.length; i++) {
|
||||
if (month == exclude_months[i]) {
|
||||
return [false];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [true];
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* wcj-disable-quantity.
|
||||
*
|
||||
* version 2.5.2
|
||||
* since 2.5.2
|
||||
*/
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("div.quantity input.qty").each( function () {
|
||||
jQuery(this).attr("disabled", "disabled");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* eu-vat-number.
|
||||
*
|
||||
* @version 2.7.0
|
||||
*/
|
||||
|
||||
var _ajax_object = ajax_object;
|
||||
|
||||
jQuery( function( $ ) {
|
||||
|
||||
// Setup before functions
|
||||
var inputTimer; //timer identifier
|
||||
var doneInputInterval = 1000; //time in ms
|
||||
var $vatInput = $('input[name="billing_eu_vat_number"]');
|
||||
var $vatParagraph = $('p[id="billing_eu_vat_number_field"]');
|
||||
|
||||
// Add progress text
|
||||
if ('yes'==_ajax_object.add_progress_text) {
|
||||
$vatParagraph.append('<div id="wcj_eu_vat_number_progress"></div>');
|
||||
var $progressText = $('div[id="wcj_eu_vat_number_progress"]');
|
||||
}
|
||||
|
||||
// Initial validate
|
||||
validateVat();
|
||||
|
||||
// On input, start the countdown
|
||||
$vatInput.on('input', function() {
|
||||
clearTimeout(inputTimer);
|
||||
inputTimer = setTimeout(validateVat, doneInputInterval);
|
||||
});
|
||||
|
||||
// Validate VAT
|
||||
function validateVat() {
|
||||
$vatParagraph.removeClass('woocommerce-invalid');
|
||||
$vatParagraph.removeClass('woocommerce-validated');
|
||||
var vatNumberToCheck = $vatInput.val();
|
||||
if (''!=vatNumberToCheck) {
|
||||
// Validating EU VAT Number through AJAX call
|
||||
if ('yes'==_ajax_object.add_progress_text) {
|
||||
$progressText.text(_ajax_object.progress_text_validating);
|
||||
}
|
||||
var data = {
|
||||
'action': 'wcj_validate_eu_vat_number',
|
||||
'wcj_eu_vat_number_to_check': vatNumberToCheck,
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: _ajax_object.ajax_url,
|
||||
data: data,
|
||||
success: function(response) {
|
||||
if ('1'==response) {
|
||||
$vatParagraph.addClass('woocommerce-validated');
|
||||
if ('yes'==_ajax_object.add_progress_text) {
|
||||
$progressText.text(_ajax_object.progress_text_valid);
|
||||
}
|
||||
} else if ('0'==response) {
|
||||
$vatParagraph.addClass('woocommerce-invalid');
|
||||
if ('yes'==_ajax_object.add_progress_text) {
|
||||
$progressText.text(_ajax_object.progress_text_not_valid);
|
||||
}
|
||||
} else {
|
||||
$vatParagraph.addClass('woocommerce-invalid');
|
||||
if ('yes'==_ajax_object.add_progress_text) {
|
||||
$progressText.text(_ajax_object.progress_text_validation_failed);
|
||||
}
|
||||
}
|
||||
$('body').trigger('update_checkout');
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// VAT input is empty
|
||||
if ('yes'==_ajax_object.add_progress_text) {
|
||||
$progressText.text('');
|
||||
}
|
||||
if ($vatParagraph.hasClass('validate-required')) {
|
||||
// Required
|
||||
$vatParagraph.addClass('woocommerce-invalid');
|
||||
} else {
|
||||
// Not required
|
||||
$vatParagraph.addClass('woocommerce-validated');
|
||||
}
|
||||
$('body').trigger('update_checkout');
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* wcj-offer-price.
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.9.0
|
||||
*/
|
||||
|
||||
// Get the modal
|
||||
var modal = jQuery('#wcj-offer-price-modal');
|
||||
|
||||
// When the user clicks on the button, fill in values and open the modal
|
||||
jQuery('.wcj-offer-price-button').click(function(){
|
||||
// Get data
|
||||
var wcj_data = jQuery.parseJSON(jQuery(this).attr('wcj_data'));
|
||||
// Fill in price input
|
||||
var price_input = jQuery('#wcj-offer-price-price');
|
||||
price_input.attr('step',wcj_data['price_step']);
|
||||
price_input.attr('min',wcj_data['min_price']);
|
||||
if (0 != wcj_data['max_price']){
|
||||
price_input.attr('max',wcj_data['max_price']);
|
||||
}
|
||||
if (0 != wcj_data['default_price']){
|
||||
price_input.val(wcj_data['default_price']);
|
||||
}
|
||||
jQuery('#wcj-offer-price-price-label').html(wcj_data['price_label']);
|
||||
// Fill in form header
|
||||
jQuery('#wcj-offer-form-header').html(wcj_data['form_header']);
|
||||
// Product ID (hidden input)
|
||||
jQuery('#wcj-offer-price-product-id').val(wcj_data['product_id']);
|
||||
// Show the form
|
||||
modal.css('display','block');
|
||||
});
|
||||
|
||||
// When the user clicks on <span> (x), close the modal
|
||||
jQuery('.wcj-offer-price-form-close').first().click(function(){
|
||||
modal.css('display','none');
|
||||
});
|
||||
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
jQuery(window).click(function(e){
|
||||
if (modal.is(e.target)){
|
||||
modal.css('display','none');
|
||||
}
|
||||
});
|
||||
|
||||
// When the user presses ESC, close the modal
|
||||
jQuery(document).keyup(function(e){
|
||||
if (27 === e.keyCode){ // esc
|
||||
modal.css('display','none');
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* wcj-order-quantities.js
|
||||
*
|
||||
* @version 3.2.3
|
||||
* @since 3.2.2
|
||||
*/
|
||||
|
||||
function check_qty(){
|
||||
var variation_id = jQuery('[name=variation_id]').val();
|
||||
if (0 == variation_id) {
|
||||
return;
|
||||
}
|
||||
var current_qty = jQuery('[name=quantity]').val();
|
||||
if (quantities_options['reset_to_min']){
|
||||
jQuery('[name=quantity]').val(product_quantities[variation_id]['min_qty']);
|
||||
} else if (quantities_options['reset_to_max']){
|
||||
jQuery('[name=quantity]').val(product_quantities[variation_id]['max_qty']);
|
||||
} else if (current_qty < parseInt(product_quantities[variation_id]['min_qty'])){
|
||||
jQuery('[name=quantity]').val(product_quantities[variation_id]['min_qty']);
|
||||
} else if (current_qty > parseInt(product_quantities[variation_id]['max_qty'])){
|
||||
jQuery('[name=quantity]').val(product_quantities[variation_id]['max_qty']);
|
||||
}
|
||||
}
|
||||
|
||||
function check_qty_no_reset(){
|
||||
var variation_id = jQuery('[name=variation_id]').val();
|
||||
if (0 == variation_id) {
|
||||
return;
|
||||
}
|
||||
var current_qty = jQuery('[name=quantity]').val();
|
||||
if (current_qty < parseInt(product_quantities[variation_id]['min_qty'])){
|
||||
jQuery('[name=quantity]').val(product_quantities[variation_id]['min_qty']);
|
||||
} else if (current_qty > parseInt(product_quantities[variation_id]['max_qty'])){
|
||||
jQuery('[name=quantity]').val(product_quantities[variation_id]['max_qty']);
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('[name=variation_id]').on('change',check_qty);
|
||||
if (quantities_options['force_on_add_to_cart']){
|
||||
jQuery('.single_add_to_cart_button').on('click',check_qty_no_reset);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* wcj-pdf-invoicing.
|
||||
*
|
||||
* version 2.5.2
|
||||
* since 2.5.2
|
||||
*/
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('a.wcj_need_confirmation').click(function() {
|
||||
return confirm("Are you sure?");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* wcj-price-by-user-role-admin.js
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 3.6.0
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('.wcj-copy-price').click(function() {
|
||||
var wcj_copy_data = jQuery.parseJSON(jQuery(this).attr('wcj-copy-data'));
|
||||
var source_input_id = '#wcj_price_by_user_role_'+wcj_copy_data.price+'_price_'+wcj_copy_data.source_role+'_'+wcj_copy_data.source_product;
|
||||
if ('copy_to_roles' == wcj_copy_data.action) {
|
||||
wcj_copy_data.dest_roles.forEach(function(element) {
|
||||
var dest_input_id = '#wcj_price_by_user_role_'+wcj_copy_data.price+'_price_'+element+'_'+wcj_copy_data.source_product;
|
||||
jQuery(dest_input_id).val(jQuery(source_input_id).val());
|
||||
});
|
||||
} else if ('copy_to_variations' == wcj_copy_data.action) {
|
||||
wcj_copy_data.dest_products.forEach(function(element) {
|
||||
var dest_input_id = '#wcj_price_by_user_role_'+wcj_copy_data.price+'_price_'+wcj_copy_data.source_role+'_'+element;
|
||||
jQuery(dest_input_id).val(jQuery(source_input_id).val());
|
||||
});
|
||||
} else if ('copy_to_roles_and_variations' == wcj_copy_data.action) {
|
||||
wcj_copy_data.dest_roles.concat(wcj_copy_data.source_role).forEach(function(element_role) {
|
||||
wcj_copy_data.dest_products.concat(wcj_copy_data.source_product).forEach(function(element_var) {
|
||||
var dest_input_id = '#wcj_price_by_user_role_'+wcj_copy_data.price+'_price_'+element_role+'_'+element_var;
|
||||
jQuery(dest_input_id).val(jQuery(source_input_id).val());
|
||||
});
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* wcj-product-addons.
|
||||
*
|
||||
* @version 3.2.2
|
||||
* @since 2.5.3
|
||||
* @todo `text` type - update price not only on change, but on each pressed key
|
||||
* @todo fix the issue with custom price labels module
|
||||
*/
|
||||
|
||||
var _ajax_object = ajax_object;
|
||||
|
||||
function change_price() {
|
||||
var is_variation_ok = true;
|
||||
if ( jQuery(".variations select").length ) {
|
||||
if ( jQuery(".variations select").find(":selected").val() == '' ) {
|
||||
is_variation_ok = false;
|
||||
}
|
||||
}
|
||||
if ( is_variation_ok ) {
|
||||
var product_id = jQuery("input[type='hidden'][name='variation_id']").val();
|
||||
var is_variable;
|
||||
if ( ! product_id ) {
|
||||
is_variable = false;
|
||||
product_id = _ajax_object.product_id;
|
||||
} else {
|
||||
if ( 0 == product_id ) {
|
||||
setTimeout(change_price, 100);
|
||||
return;
|
||||
}
|
||||
is_variable = true;
|
||||
}
|
||||
var data = {
|
||||
'action': 'product_addons_price_change',
|
||||
'product_id': product_id,
|
||||
};
|
||||
jQuery("input[name^='wcj_product_all_products_addons_'], input[name^='wcj_product_per_product_addons_']").each( function () {
|
||||
if (jQuery(this).is(':checked')) {
|
||||
data[jQuery(this).attr('name')] = jQuery(this).val();
|
||||
}
|
||||
if ('text'==jQuery(this).attr('type') && jQuery(this).val()!='') {
|
||||
data[jQuery(this).attr('name')] = jQuery(this).val();
|
||||
}
|
||||
});
|
||||
jQuery("select[name^='wcj_product_all_products_addons_'], select[name^='wcj_product_per_product_addons_']").each( function () {
|
||||
data[jQuery(this).attr('name')] = jQuery(this).find(':selected').val();
|
||||
});
|
||||
jQuery.post(_ajax_object.ajax_url, data, function(response) {
|
||||
if ( '' != response ) {
|
||||
if ( ! is_variable || _ajax_object.is_variable_with_single_price ) {
|
||||
jQuery("p[class='price']").html(response);
|
||||
} else if ( is_variable ) {
|
||||
jQuery("span[class='price']").html(response);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
change_price();
|
||||
jQuery("[name^='wcj_product_all_products_addons_'], [name^='wcj_product_per_product_addons_']").each( function () {
|
||||
jQuery(this).change( change_price );
|
||||
});
|
||||
});
|
||||
|
||||
jQuery(document.body).on('change','.variations select',change_price);
|
||||
jQuery(document.body).on('change','input[name="wcj_variations"]',change_price);
|
||||
@@ -0,0 +1,9 @@
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('input,textarea').focus(function(){
|
||||
jQuery(this).data('placeholder',jQuery(this).attr('placeholder'))
|
||||
jQuery(this).attr('placeholder','');
|
||||
});
|
||||
jQuery('input,textarea').blur(function(){
|
||||
jQuery(this).attr('placeholder',jQuery(this).data('placeholder'));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* wcj-shipping-calculator.
|
||||
*
|
||||
* @version 2.5.7
|
||||
* @since 2.5.7
|
||||
*/
|
||||
|
||||
jQuery(document).ready(change_labels);
|
||||
jQuery(document).ajaxComplete(change_labels);
|
||||
function change_labels() {
|
||||
jQuery("a.shipping-calculator-button").each( function () {
|
||||
jQuery(this).text( wcj_object.calculate_shipping_label );
|
||||
jQuery(this).css( "visibility", "visible" );
|
||||
});
|
||||
jQuery("button[name=calc_shipping]").each( function () {
|
||||
jQuery(this).text( wcj_object.update_totals_label );
|
||||
jQuery(this).css( "visibility", "visible" );
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Booster for WooCommerce - Timepicker JS
|
||||
*
|
||||
* @version 2.7.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("input[display='time']").each( function () {
|
||||
jQuery(this).timepicker({
|
||||
timeFormat : jQuery(this).attr("timeformat"),
|
||||
interval : jQuery(this).attr("interval"),
|
||||
minTime: jQuery(this).attr("mintime"),
|
||||
maxTime: jQuery(this).attr("maxtime")
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* wcj-track-users.js
|
||||
*
|
||||
* @version 2.9.1
|
||||
* @version 2.9.1
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
var data = {
|
||||
'action': 'wcj_track_users',
|
||||
'wcj_http_referer': track_users_ajax_object.http_referer,
|
||||
'wcj_user_ip': track_users_ajax_object.user_ip
|
||||
};
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: track_users_ajax_object.ajax_url,
|
||||
data: data,
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Booster for WooCommerce - Variations Radio Buttons
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
/**
|
||||
* maybe_hide_unavailable.
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function maybe_hide_unavailable(variation) {
|
||||
if ( ! variation.is_purchasable || ! variation.is_in_stock || ! variation.variation_is_visible ) {
|
||||
jQuery( '.single_add_to_cart_button' ).removeClass( 'wc-variation-selection-needed' ).addClass( 'disabled wc-variation-is-unavailable' );
|
||||
jQuery( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* process_variations.
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function process_variations(variation_id) {
|
||||
var data_product_variations = jQuery.parseJSON(jQuery("form.variations_form.cart").attr('data-product_variations'));
|
||||
data_product_variations.forEach(function(variation){
|
||||
if(variation_id == variation.variation_id){
|
||||
maybe_hide_unavailable(variation);
|
||||
jQuery("form.variations_form.cart").wc_variations_image_update(variation);
|
||||
jQuery("div.woocommerce-variation-price").html(variation.price_html);
|
||||
jQuery("div.woocommerce-variation-availability").html(variation.availability_html);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* hide_all.
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function hide_all() {
|
||||
jQuery("div.woocommerce-variation-availability").hide();
|
||||
jQuery("div.woocommerce-variation-price").hide();
|
||||
jQuery( '.single_add_to_cart_button' ).removeClass( 'wc-variation-is-unavailable' ).addClass( 'disabled wc-variation-selection-needed' );
|
||||
jQuery( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' );
|
||||
}
|
||||
|
||||
/**
|
||||
* show_all.
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function show_all() {
|
||||
jQuery("div.woocommerce-variation-availability").show();
|
||||
jQuery("div.woocommerce-variation-price").show();
|
||||
jQuery( '.single_add_to_cart_button' ).removeClass( 'disabled wc-variation-selection-needed wc-variation-is-unavailable' );
|
||||
jQuery( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-disabled' ).addClass( 'woocommerce-variation-add-to-cart-enabled' );
|
||||
}
|
||||
|
||||
/**
|
||||
* fill_values.
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function fill_values(variation_id,radio_element) {
|
||||
jQuery("input:hidden[name='variation_id']").val(variation_id);
|
||||
jQuery(radio_element.attributes).each(
|
||||
function(i, attribute){
|
||||
if(attribute.name.match("^attribute_")){
|
||||
jQuery("input:hidden[name='" + attribute.name + "']").val(attribute.value);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* document ready.
|
||||
*
|
||||
* @version 2.9.0
|
||||
*/
|
||||
jQuery(document).ready(function() {
|
||||
// Initial display
|
||||
jQuery("form.variations_form.cart").on('wc_variation_form',function(){
|
||||
if(jQuery("input:radio[name='wcj_variations']").is(':checked')){
|
||||
show_all();
|
||||
var checked_radio = jQuery("input:radio[name='wcj_variations']:checked");
|
||||
var variation_id = checked_radio.attr("variation_id");
|
||||
fill_values(variation_id, checked_radio[0]);
|
||||
process_variations(variation_id);
|
||||
} else {
|
||||
hide_all();
|
||||
}
|
||||
});
|
||||
// On change
|
||||
jQuery("input:radio[name='wcj_variations']").change(
|
||||
function(){
|
||||
show_all();
|
||||
var variation_id = jQuery(this).attr("variation_id");
|
||||
fill_values(variation_id, this);
|
||||
process_variations(variation_id);
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* wcj-wSelect.
|
||||
*
|
||||
* version 2.5.4
|
||||
* since 2.5.4
|
||||
*/
|
||||
jQuery('select#wcj-country').wSelect();
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* wcj-weekpicker.
|
||||
*
|
||||
* version 2.4.7
|
||||
*/
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("input[display='week']").each( function () {
|
||||
jQuery(this).datepicker({
|
||||
dateFormat : jQuery(this).attr("dateformat"),
|
||||
minDate : jQuery(this).attr("mindate"),
|
||||
maxDate : jQuery(this).attr("maxdate"),
|
||||
firstDay : jQuery(this).attr("firstday"),
|
||||
changeYear: jQuery(this).attr("changeyear"),
|
||||
yearRange: jQuery(this).attr("yearrange"),
|
||||
showOtherMonths: true,
|
||||
selectOtherMonths: true,
|
||||
changeMonth: true,
|
||||
showWeek: true,
|
||||
beforeShow: function(dateText, inst) {
|
||||
// for week highighting
|
||||
jQuery(".ui-datepicker-calendar tbody tr").live("mousemove", function() {
|
||||
jQuery(this).find("td a").addClass("ui-state-hover");
|
||||
jQuery(this).find(".ui-datepicker-week-col").addClass("ui-state-hover");
|
||||
});
|
||||
jQuery(".ui-datepicker-calendar tbody tr").live("mouseleave", function() {
|
||||
jQuery(this).find("td a").removeClass("ui-state-hover");
|
||||
jQuery(this).find(".ui-datepicker-week-col").removeClass("ui-state-hover");
|
||||
});
|
||||
},
|
||||
onClose: function(dateText, inst) {
|
||||
var date = jQuery(this).datepicker( "getDate" );
|
||||
if (date != null){
|
||||
var dateFormat = inst.settings.dateFormat || jQuery(this).datepicker._defaults.dateFormat;
|
||||
var endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 6);
|
||||
var endDateFormatted = jQuery.datepicker.formatDate( dateFormat, endDate, inst.settings );
|
||||
jQuery(this).val(dateText + " - " + endDateFormatted);
|
||||
}
|
||||
// disable live listeners so they dont impact other instances
|
||||
jQuery(".ui-datepicker-calendar tbody tr").die("mousemove");
|
||||
jQuery(".ui-datepicker-calendar tbody tr").die("mouseleave");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user