weeknumber
-
I’m trying to make a weeknumber for the checkout procces.
So first i did:woocommerce_form_field( 'e_deliverydate', array( 'type' => 'select', 'label' => 'Weeknumber', 'options' => array('Week 1','Week 2','Week 3'), (ect to 52) 'default' => 'Week '. date("W") + 1, );
This works out great, accept for the default input.
The second problem, is that i dont want to show the weeks before.I did this ones with a regular form:
Could someone help me out to do this?
I can’t seem to put a “for” loop in a “array”$weeks_in_year = strftime("%W",strtotime("12/31/" . date("Y") . "")); $huidig_weeknummer = date("W"); if($maximale_levertijd == "") { $reservering_minimaal_week = $huidig_weeknummer + 1; } else { $reservering_minimaal_week = $huidig_weeknummer + $maximale_levertijd; } <select name="weekreservering" id="weekreservering"> <option value="">(Kies een weeknummer)</option> <?php $weeknummer = 1; // Startweek for($weeknummer = 1; $weeknummer <=53; $weeknummer++) { if($weeknummer < $reservering_minimaal_week || ($weeknummer >= 53 && $weeknummer <= 53)) { $niet_selecteerbaar = "disabled = 'disabled'"; } else { $niet_selecteerbaar = ""; } if($weeknummer >= $reservering_minimaal_week && ($weeknummer < 53 || $weeknummer > 53)) { if(isset($_GET['weekreservering'])) { $reservering_selected = $_GET['weekreservering']; } else { $reservering_selected = $reservering_minimaal_week; } if($weeknummer == $reservering_selected) { $geselecteerd = "selected = 'selected'"; } else { $geselecteerd = ""; } echo "<option value='" . $weeknummer . "' " . $niet_selecteerbaar . " " . $geselecteerd . ">Week?" . $weeknummer . "</option>"; } } if ($huidig_weeknummer > 35) { $weeknummer2 = 1; // Startweek for($weeknummer2 == 1; $weeknummer2 <=35; $weeknummer2++) { echo "<option value='" . $weeknummer2 . "'>Week?" . $weeknummer2 . "</option>";}} ?> </select>
- The topic ‘weeknumber’ is closed to new replies.