Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter freddes51

    (@freddes51)

    WordPress 4.4.2
    Woocommerce 2.5.5
    Woocommerce checkout manager 4.0.2

    Thank you

    Hi freddes51, we will need to pass an option to the timepicker to support 24 hour, I suggest you look at the timepicker JavaScript file and see if you can edit the JavaScript file to change the format. I’ve made a task to add this once we get the 4.0 Plugin release stable as there’s been alot of changes and things to fix.

    Thread Starter freddes51

    (@freddes51)

    Thank you, i found a solution by editing the javascript file.

    Even with the datepicker by editing woocommerce-checkout-manager.php

    Hi freddes51, great, I’ll make a WordPress Filter available so you can override that. Can you confirm what line you changed so I can get this done in the next minor Plugin update?

    Thread Starter freddes51

    (@freddes51)

    1 . For the time picker:

    Edit file /wp-content/plugins/woocommerce-checkout-manager/includes/pickers/jquery.ui.timepicker.js

    -Comment the two “if” line 736 and 739 to show 24 hours

    To remove AM/PM in the selected hour:
    -Line 1305 to 1318, comment the “if”

    And to remove AM and PM from the timepicker:
    Line 89 showperiodlabels: false,

    2. for the date picker:
    -edit /public_html/wp-content/plugins/woocommerce-checkout-manager/woocommerce-checkout-manager.php

    Comment the “if” line 182 to 188
    And add for a french translation:

    `wp_register_script( ‘jquery.ui.datepicker-fr’, plugins_url( ‘includes/pickers/di18n/jquery.ui.datepicker-fr.js’, WOOCCM_RELPATH ) );
    wp_enqueue_script(‘jquery.ui.datepicker-fr’);

    /*wp_enqueue_script(‘jquery-ui-datepicker’);*/
    `

    Hi freddes51, got it, there’s a nicer way we can do this using WordPress Filters which will mean it is update safe. I’ve made a note to look over this as part of the next minor Plugin update and will make a link to the tutorial for applying the snippet to your Theme’s functions.php file ??

    Hi freddes51, okay add the following to your Theme’s functions.php file once you’ve installed the 4.0.3 Plugin update going out later today. No more hard-code changes to our Plugin ??

    <?php
    // This one overrides the formatting within TimePicker
    function custom_wooccm_timepicker_jquery_args( $args, $btn ) {

    $args = ‘
    showPeriodLabels: false
    ‘;
    return $args;

    }
    add_filter( ‘wooccm_timepicker_jquery_args’, ‘custom_wooccm_timepicker_jquery_args’, 10, 2 );

    // This one overrides the language to FR where WPML is not in use
    function custom_wooccm_language_code() {

    return ‘FR’;

    }
    add_filter( ‘wooccm_language_code’, ‘custom_wooccm_language_code’ );
    ?>

    Hi, Michael! I used the code you provided, and it helped with 24h time format, and days of week became translated into Russian (I’ve just changed ‘FR’ to ‘RU’))
    But, the time toggler doesn’t work at all now, so the time period chosen doesn’t change anything in the picker, and unfortunatelly the “HOUR” and “MINUTE” words in time picker are not translated.

    Could you please help with the issue?

    Great thanks!

    Hi kotus9, do you see any jQuery errors within the Web Developer tab of your browser tools?

    evertbotterweg

    (@evertbotterweg)

    @visser

    Hi Michael,

    When i try your solution in version 4.0.9 and i get error

    Parse error: syntax error, unexpected ‘showPeriodLabels’ (T_STRING) in /public/sites/www.indeseyen-ontwikkeling.nl/wp-content/themes/noo-organici/functions.php on line 369

    i disabled the function.php option now… The timepicker here should be 24 hour https://www.indeseyen-ontwikkeling.nl/checkout/

    I also tried @freddes51 solution but no luck

    Hi evertbotterweg, looking at the PHP snippet above try this alteration:

    // This one overrides the formatting within TimePicker
    function custom_wooccm_timepicker_jquery_args( $args, $btn ) {
    
    $args .= '
    showPeriodLabels: false
    ';
    return $args;
    
    }
    add_filter( 'wooccm_timepicker_jquery_args', 'custom_wooccm_timepicker_jquery_args', 10, 2 );
    evertbotterweg

    (@evertbotterweg)

    Parse error: syntax error, unexpected ‘showPeriodLabels’ (T_STRING) in /public/sites/www.indeseyen-ontwikkeling.nl/wp-content/themes/noo-organici/functions.php on line 368

    i pasted your snippet at the bottom of the functions.php in the theme

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘time picker 24h without AM PM’ is closed to new replies.