WC Lovers

WooCommerce Frontend Manager - Multivendor marketplace vendor dashboard

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Delivery Time (New Module) #127427

    Ok, couple of amends that we’ve made to the code to get it a little more suitable for what we need.

    When you select only delivery date to show you end up getting a time being displayed on the screen on the orders and order summary.

    We amended as follows: (if delivery display format set to date then set current_time to midnight and work from there)

    All in wp-content/plugins/wc-frontend-manager-delivery/core/class-wcfmd-delivery-time.php

    In generate_vendor_delivery_time_checkout_field (around line 389)

    if ($wcfm_delivery_time_display_format == 'date'){
         //reset to midnight of today
         $current_time = strtotime('today midnight');
     }
    else {
         $current_time = current_time( 'timestamp' );
    }

    Then to make the time selection slightly nicer make them start on say 15 min blocks. Rather than 7:42am as an option have 7:45am instead..

    Inbetween where $start_time and $end_time are first set in generate_vendor_delivery_time_checkout_field:

                //lets start at a more reasonable time.. i.e. in the next 15 min block
                $datetime = new DateTime;
                $datetime->setTimestamp($start_time);
                $second = $datetime->format("s");
                if($second > 0)
                    $datetime->add(new DateInterval("PT".(60-$second)."S"));
                $minute = $datetime->format("i");
                $minute = $minute % 15;
                if($minute != 0)
                {
                    // Count difference
                    $diff = 15 - $minute;
                    // Add difference
                    $datetime->add(new DateInterval("PT".$diff."M"));
                    $start_time = $datetime->getTimestamp();
                }

    finally change the section that sets $is_valid_time = true to be greater than or equal to etc.. rather than just greater than and less than:
    Note its $next_time_slot >= $open_hours and $next_time_slot <= $close_hours that have just had the equals (=) sign adding in.. makes it work better for me.. especially if it’s delivery days that vendors are using (needs open time to be 00:00 and close time to be 23:59 in delivery times)

    if( ( $next_time_slot >= $open_hours ) && ( $next_time_slot <= $close_hours ) )  {
       $is_valid_time = true;
       break;
    }

    in wcfmd_customer_order_delivery_time_show, wcfmd_order_list_delivery_time_show, wcfmd_order_details_delivery_time_show
    If date is midnight (i.e. it’s just display date) setting then don’t display time part..

    within the for each loop: (check if date time is midnight and if so then only show date)

    $datetime = new DateTime;
    $datetime->setTimestamp($wcfmd_delvery_time);
    
    if( date_format($datetime,'H') == 0 && date_format($datetime,'i') == 0) {
         echo date_i18n( wc_date_format(), $wcfmd_delvery_time );
    }
    else {
         echo date_i18n( wc_date_format() . ' ' . wc_time_format(), $wcfmd_delvery_time );
    }

    Bit of a brain dump but hope it makes sense! (have also attached file)

Viewing 1 post (of 1 total)