php - WooCommerce Bookings - Available dates as drop down menu -


i'm trying customize booking experience. products tours spread on year , scrolling through calendar find available day isn't efficient. want drop down list has next available day tour. there plugin or solution situation?

hi file located in wp-content/plugins/woocommerce-bookings/templates/booking-form

the code in post described works part there errors

warning: reset() expects parameter 1 array, string given in /home/betaacademyofflo/public_html/wp-content/plugins/woocommerce-bookings/templates/booking-form/date-picker.php on line 54

warning: variable passed each() not array or object in /home/betaacademyofflo/public_html/wp-content/plugins/woocommerce-bookings/templates/booking-form/date-picker.php on line 55

this error appears every date available.

a tweak trying make select list shows duplicates of each date need show date once.

by each date once mean start date bookings have same start , end date.

you can see example here example list have suppresed errors now. heres code far pretty same op version on wordress support.

   <?php    $year = array();    $month = array();    $days = array();    $s;    $day1;    $i=0;    $j=0;     foreach ($availability_rules $value) {      foreach ( $value  $value2) {          foreach ( $value2  $value3) {              reset($value3);             while (list($key, $val) = each($value3)) {              $year[$i] = $key; //add year array - $i count of how many course              reset($val);             while (list($key2, $val2) = each($val)) {                 if($key2 < 10){                     $month[$i] = '0'.$key2; //add month value array - leading 0                 }else{                      $month[$i] = $key2; //add month value array                 }                  $s = "";                 $j = 0;                 reset($val2);                 while (list($key3, $val3) = each($val2)) {                      if($j==0||$j==1){                         $s = $s . $key3 .',';                     }else{                         $s = $s . $key3;                     }                     if($j==0){                         $day1[$i] = $key3; //add day value array                     }                      $j++;                  }                 $days[$i] = $s;             }              $i++; //increments each time loop through year              }         }      }    }    $arrlength = 0;    $arrlength = count($year); //this our total amount of courses     ?>    <fieldset class="wc-bookings-date-picker <?php echo implode( ' ', $class ); ?>">    <legend><?php echo $label; ?>: </small></legend>    <select id="availabledates">    <option value="">select date</option>    <?php     if($arrlength==0){         echo "<option value=''>there no dates</option>";     }else{         $todays_date = date("d-m-y");             $today = strtotime($todays_date);         for($total_dates = $arrlength -1; $total_dates >= 0; $total_dates--){ //loop through total amount              $expiration_date =strtotime($day1[$total_dates].'-'.$month[$total_dates].'-'.$year[$total_dates]);               $actualdates = $day1[$total_dates]-$month[$total_dates]-$year[$total_dates];             $displaydates = $day1[$total_dates]/$month[$total_dates]/$year[$total_dates];             //$input = array( $day1[$total_dates]-$month[$total_dates]-$year[$total_dates]);             //$result = array_keys($input);              if ($expiration_date > $today) {                     echo "<option value='$day1[$total_dates]-$month[$total_dates]-$year[$total_dates]'>$day1[$total_dates]/$month[$total_dates]/$year[$total_dates]</option>"; //pull in index each date array              }         }     }      ?> 

what i've tried;

running foreach on final result did not work tried array_unique did not work

anny guidance here aprreciated.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -