Re: Order Delivery Date Support Thread
mrrmeech,
Thanks for your prompt reply and the link to the date lesson. You know what they say about "...fools rushing in..." That would be ME.
Yes, I was just looking to get the date to display in the Monty/Day/Year format. Now that I've read the tutorial (should have done that first LOL) I see the problem.
Although it does not seem to have "broken" the drop down display it does not store as expected in the database. Would you suggest I just change it back to the proper Mysql format and live with it? That is learn the Year first format. LOL
Re: Order Delivery Date Support Thread
Quote:
Originally Posted by
duffy
mrrmeech,
Thanks for your prompt reply and the link to the date lesson. You know what they say about "...fools rushing in..." That would be ME.
Yes, I was just looking to get the date to display in the Monty/Day/Year format. Now that I've read the tutorial (should have done that first LOL) I see the problem.
Although it does not seem to have "broken" the drop down display it does not store as expected in the database. Would you suggest I just change it back to the proper Mysql format and live with it? That is learn the Year first format. LOL
I would change it back to how to the original file for now and i'll see if i can get you a new one to try in a day or so - i'm super slammed with work until tomorrow!
Re: Order Delivery Date Support Thread
Thanks mrmeech, I'll change it back. Don't go out of your way for a fix, it's really not a big deal, but your help is immensely appreciated!!
Re: Order Delivery Date Support Thread
Is this where the line forms behind duffy for the mm/dd/yy version?? :wink:
Definitely been waiting for this mod - thank you!
betty
Re: Order Delivery Date Support Thread
Quote:
Originally Posted by
bettysue
Is this where the line forms behind duffy for the mm/dd/yy version?? :wink:
Definitely been waiting for this mod - thank you!
betty
Quote:
Originally Posted by
duffy
Thanks mrmeech, I'll change it back. Don't go out of your way for a fix, it's really not a big deal, but your help is immensely appreciated!!
Try this out...
(Duffy, you *shouldn't* have any awkward date problems with this, but test it out and let me know)
You want to open up includes/templates/YOURTEMPLATE/templates/tpl_checkout_shipping_default.php and use this code near the bottom instead of what's there:
PHP Code:
<!-- Bof Ship Date -->
<fieldset class="shipping" id="order_delivery_date">
<legend><?php echo TABLE_HEADING_DELIVERY_DATE; ?></legend>
<select name="order_delivery_date">
<?php
for ($i=0, $n=50; $i < $n; $i++) {
$now[$i] = strtotime ("+$i day", time());
if ( strftime ("%w",$now[$i])<>0
AND strftime ("%m-%d",$now[$i])<>"12-25"
AND strftime ("%m-%d",$now[$i])<>"12-26"
AND strftime ("%m-%d",$now[$i])<>"01-01"
){
echo '<option value="'.strftime ("%Y-%m-%d",$now[$i]).'">'.strftime ("%B %d %Y (%A)",$now[$i]).'</option>';
}
}
?>
</select>
</fieldset>
<!-- Eof Ship Date -->
Re: Order Delivery Date Support Thread
Thanks mrmeech. I've implemented the code change and this generates a nice drop down for the date selection but when I get to the confirmation stage of order processing the date is again displaying in in the yyyy/mm/dd format. Do we need to make a similar change in the tpl_checkout_confirmation page?
duffy.
Re: Order Delivery Date Support Thread
Mrmech,
Awesome contribution. :clap:
Working beautifully on a 1.3.8a - with a few easy cutomisations it now works with my templates - waiting now to try and see how we go with implementing into superorders and other contributions :bigups:
I'll try and post my customisations with other contributions if they actually work well enough to post!!
I have really been wanting something like this that's stable and seems fairly easy to customise also.
**** So here's the question:
I have tried in vane to try and work out the date how to turn off Saturday - Sunday is off as default - but not sure which bit of code turns it off and how!!!
Could you please advise how to turn off Saturday as well as Sunday ( or I guess any day when I understand how it works).
Thanks you very much for putting this up and your support for it.
Max
Re: Order Delivery Date Support Thread
Quote:
Originally Posted by
duffy
Thanks mrmeech. I've implemented the code change and this generates a nice drop down for the date selection but when I get to the confirmation stage of order processing the date is again displaying in in the yyyy/mm/dd format. Do we need to make a similar change in the tpl_checkout_confirmation page?
duffy.
try updating these lines of code in your tpl_checkout_confirmation_default.php
PHP Code:
<?php // BEGIN Order Delivery Date ?>
<h3><?php echo TABLE_HEADING_DELIVERY_DATE; ?></h3>
<p><h4><?php echo zen_date_long($order->info['order_delivery_date']); ?></h4></p><br />
</div>
<?php // END ORder Delivery Date ?>
Re: Order Delivery Date Support Thread
Quote:
Originally Posted by
FuzzyBunny
Mrmech,
Awesome contribution. :clap:
Working beautifully on a 1.3.8a - with a few easy cutomisations it now works with my templates - waiting now to try and see how we go with implementing into superorders and other contributions :bigups:
I'll try and post my customisations with other contributions if they actually work well enough to post!!
I have really been wanting something like this that's stable and seems fairly easy to customise also.
**** So here's the question:
I have tried in vane to try and work out the date how to turn off Saturday - Sunday is off as default - but not sure which bit of code turns it off and how!!!
Could you please advise how to turn off Saturday as well as Sunday ( or I guess any day when I understand how it works).
Thanks you very much for putting this up and your support for it.
Max
Max,
Open up tpl_checkout_shipping_default.php. This code should do the trick:
PHP Code:
<!-- Bof Ship Date -->
<fieldset class="shipping" id="order_delivery_date">
<legend><?php echo TABLE_HEADING_DELIVERY_DATE; ?></legend>
<select name="order_delivery_date">
<?php
for ($i=0, $n=50; $i < $n; $i++) {
$now[$i] = strtotime ("+$i day", time());
if ( strftime ("%w",$now[$i])<>0
AND strftime ("%w", $now[$i])<>6
AND strftime ("%m-%d",$now[$i])<>"12-25"
AND strftime ("%m-%d",$now[$i])<>"12-26"
AND strftime ("%m-%d",$now[$i])<>"01-01"
){
echo '<option value="'.strftime ("%Y-%m-%d",$now[$i]).'">'.strftime ("%B %d %Y (%A)",$now[$i]).'</option>';
}
}
?>
</select>
</fieldset>
<!-- Eof Ship Date -->
Re: Order Delivery Date Support Thread
Mrmeech,
Still going strong on this great contribution.
I am trying to work out an admin side (in edit_orders.php currently) to this, which I can do with:
<!-- Begin Delivery Date Block -->
<hr>
<strong>Current Delivery Date: </strong><?php echo zen_date_long($order->info['order_delivery_date']); ?><br>
<strong>Reset Delivery Date to: </strong>
<select name="update_order_delivery_date">
<?php
for ($i=0, $n=365; $i < $n; $i++) {
$now[$i] = strtotime ("+$i day", time());
if ( strftime ("%w",$now[$i])<>0
AND strftime ("%w", $now[$i])<>6
AND strftime ("%m-%d",$now[$i])<>"12-25"
AND strftime ("%m-%d",$now[$i])<>"12-26"
AND strftime ("%m-%d",$now[$i])<>"01-01"
){
echo '<option value="'.strftime ("%Y-%m-%d",$now[$i]).'">'.strftime ("%d %B %Y (%A)",$now[$i]).'</option>';
}
}
?>
</select>
<?php echo zen_draw_separator('pixel_trans.gif', '50', '1'); ?>
<?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?>
<hr>
<!-- End Delivery Date Block -->
The issue is that in the pull down list the default is the next available day when I want the selected option in the list to be the order_delivery_date.
If the list doesn't default to the current order_delivery_date it runs the risk of someone updating the page and changing the delivery date to the wrong one.
I have played around with the code for ages trying to work out how to get it to do it and still keep the rest of the list the same (ie. from today to how ever many days out you have the $n value set to.
Alternatively, in your opinion, should something like this be written as a pop-up type add-on as opposed to inline code?
Any help would be greatly appreciated.
Thanks, Max