Artur Le?niewski
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Booster for WooCommerce] Product input fields – datepicker display inlineI add this code in functions.php
add_action( 'wp_enqueue_scripts', 'load_theme_scripts' ); function load_theme_scripts() { global $wp_scripts; $wp_scripts->registered[ 'wcj-datepicker' ]->src = get_template_directory_uri() . '/woocommerce-jetpack/includes/js/wcj-datepicker.js'; }
I’ve overwritten the file
/** * wcj-datepicker. * * @version 3.0.0 * @todo maybe_exclude_dates: <code>date.getDate()</code>, <code>date.getFullYear()</code> * @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 datePickerInline = jQuery(this).parent().append('<div/>'); var mindate = jQuery(this).attr("mindate"); if (mindate === 'zero') { mindate = 0; } var maxdate = jQuery(this).attr("maxdate"); if (maxdate === 'zero') { maxdate = 0; } jQuery(this).hide(); datePickerInline.datepicker({ inline: true, 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, altField: '#'+jQuery(this).attr('id'), dayNamesMin: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] }); jQuery('#'+jQuery(this).attr('id')).change(function(){ datePickerInline.datepicker('setDate', $(this).val()); }); 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]; } }); });
Viewing 1 replies (of 1 total)