????
| Current Path : /home2/morganrand/www/store/includes/checkout/ |
| Current File : /home2/morganrand/www/store/includes/checkout/ship_date.php |
<?php
$date ='';
for($i=0; $i<SHIPDATE_MINIMUM_VALUE ; $i++){
$date .= '"'.date('n-j-Y', mktime(0, 0, 0, date('n'), date('j') + $i, date('Y'))) .'",';
}
$date = '['.substr($date,0,-1).']';
$nextDate = date('n/j/Y', mktime(0, 0, 0, date('n'), date('j') + SHIPDATE_MINIMUM_VALUE , date('Y')));
?>
<table width="100%">
<tr>
<td class="main" style="padding:0 10px;">
<!--<div style="float: left; width:100%;"><strong>Estimated shipping date: <?php echo $ship_date->format('F j, Y'); ?></strong>
</div>-->
<?php //echo 'Your order will go into production queue and will be completed and shipped in 2 weeks.<br>'; ?>
<?php //echo ' Please call us at 1-888-294-4910 if you need your order shipped earlier than ' . $ship_date->format('F j, Y') . '.<br><br>'; ?>
<script>
var disDays = <?php echo $date;?>;
function nationalDays(date) {
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
for (i = 0; i < disDays.length; i++) {
if($.inArray((m+1) + '-' + d + '-' + y,disDays) != -1 ) {//|| new Date() > date
return [false];
}
}
return [true];
}
function nonWorkingDates(date){
var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
var closedDates = [[7, 29, 2009], [8, 25, 2010]];
var closedDays = [[Saturday],[Sunday]];
for (var i = 0; i < closedDays.length; i++) {
if (day == closedDays[i][0]) {
return [false];
}
}
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
for (i = 0; i < disDays.length; i++) {
if($.inArray((m+1) + '-' + d + '-' + y,disDays) != -1 ) {//|| new Date() > date
return [false];
}
}
return [true];
}
function showCal() {
if (!$("#ship_datepicker").is(":visible"))
$("#ship_datepicker").show();
$( "#ship_datepicker" ).datepicker({
minDate: new Date(),
maxDate: '',
dateFormat: 'm/d/yy',
altField: "#selectedShipDate",
dateFormat: 'm/d/yy',
defaultDate: <?php echo isset($_SESSION['shipdate'])? "'".date('n/j/Y',$_SESSION['shipdate'])."'":"'".$nextDate."'";?>,
beforeShowDay: nonWorkingDates,
onSelect: function(dateText, inst) {
$.ajax({
url: "setShipDate.php?shipDate=" + dateText,
success: function(html,text){
$('#show_dt_text').html(html);
$("#ship_datepicker").hide();
}
});
}
});
}
</script>
<div id="shipText" style="position: relative;bottom: 23px;left: 255px;"><span id="show_dt_text"><?php echo isset($_SESSION['shipdate'])?TEXT_YOUR_ARRIVAL_DATE . ' ' . date('F j, Y',$_SESSION['shipdate']):$ship_date->format('F j, Y');?></span> <span onclick="showCal();" id="show_datepicker" style="cursor:pointer; text-decoration:underline;color:#006600;">Edit</span>
<div style="position: relative;bottom: 0px;top:10px;left: -255px; font-size:15px; font-weight:bold;"> Estimated ship dates can vary by up to 5 business days. Allow up to an additional 10 days for transit time.
</div>
<div id="ship_datepicker"></div>
</div>
<span class="ship_txt_info">Your ship date is an ESTIMATE only. Wanderfuls Centerpieces are handcrafted and the actual ship date might vary by up to 5 business days. Make sure to plan at least 10 business days for transit.</span>
<input type="hidden" name="selectedShipDate" id="selectedShipDate" value="<?php echo isset($_SESSION['shipdate'])? date('n/j/Y',$_SESSION['shipdate']):$nextDate;?>" />
</td>
</tr>
</table>