Forums / Managing Customers and Orders / Order Delivery Date Support Thread

Order Delivery Date Support Thread

Results 1 to 20 of 544
27 Mar 2008, 17:54
#1
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Order Delivery Date Support Thread

This contribution will add a field during checkout where a customer can select the date which they would like a product to be delivered.

The requested delivery date will then appear on:
  • Confirm Order Page
  • Email sent to customer when order is processed
  • In the Admin: Edit Order, Invoice, Packing Slip
  • When you update the status of an order it will include the delivery date on the email generated to the customer (if you select to notify customer)
  • On the main orders page in the Admin, there is a new table field that shows the requested delivery date
This is very helpful for stores with perishable items, such as food or flowers.

This contribution is based off of the "ship date and cancel date" contribution, and i would like to make sure credit goes to everyone that has worked on this before myself (I did my best to notate this in the files). There were a number of issues with the code in that contribution and they are aiming to make more of a "PO" contribution. I simply needed a solid delivery date feature for one of my stores, so i am putting the code up for everyone else to benefit.

This is my first contribution to the zen-cart community, and it is my way of saying thanks for all the help on the forums and giving back. I really believe in this project and am proud to offer what i can.

I will post a link to the contribution's download page once it is approved by the Zen Cart administrators. (I wanted to make this thread first so i could include it in the readme.txt file)

Let the journey begin!

-MrMeech
28 Mar 2008, 16:38
#2
solarflare avatar

solarflare

Zen Follower

Join Date:
Sep 2006
Posts:
81
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

This sounds great! Exactly what I was looking for for my personal gift store!
28 Mar 2008, 19:28
#3
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

The download link is now available:

http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=976

Please let me know how this works out for you - If the installation went smoothly, please let me know! Or, if you ran into any problems or have any suggestions, please let me know that as well.

Thanks! :smile:
06 Apr 2008, 17:27
#4
duffy avatar

duffy

New Zenner

Join Date:
Aug 2005
Posts:
45
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

mrmeech,

Thank you for this contribution it is exactly what I was looking for. Installation went well although I did make a few changes to integrate with Ty's tracking module.

Thanks again!!:D
06 Apr 2008, 17:50
#5
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

duffy:

mrmeech,

Thank you for this contribution it is exactly what I was looking for. Installation went well although I did make a few changes to integrate with Ty's tracking module.

Thanks again!!:D


I'm glad it worked out for ya. :)
08 Apr 2008, 19:15
#6
pinixdesign avatar

pinixdesign

New Zenner

Join Date:
Aug 2006
Posts:
30
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

This is a great addition! Thank you.

I have one question though. the site I'm working on offers same day delivery if they order before 10am. Is there any way that I can have it not have today's date listed after 10 am???
08 Apr 2008, 22:35
#7
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

pinixdesign:

This is a great addition! Thank you.

I have one question though. the site I'm working on offers same day delivery if they order before 10am. Is there any way that I can have it not have today's date listed after 10 am???


I just wrote some code for ya - Open up /includes/templates/YOURTEMPLATE/templates/tpl_checkout_shipping_default.php

Find this code (it's near the bottom):
<!-- 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 ("%A %d %B %Y",$now[$i]).'</option>';
    }
}
?>
</select>
</fieldset>
<!-- Eof Ship Date -->
And replace it with this:

<!-- Bof Ship Date -->
<fieldset class="shipping" id="order_delivery_date">
<legend><?php echo TABLE_HEADING_DELIVERY_DATE; ?></legend>
<select name="order_delivery_date">

<?php

$current_time = (date("h:ia"));
$current_hour = (date("H")); // 24 hour time as two digits
$begin_cutoff_hour = '10'; // set on a 24 hour time clock
$end_cutoff_hour = '19'; // set on a 24 basis - "19" would be 7pm
$time_zone_adjust = '0'; // use this to adjust your hour value forward or backwards
$display_current_time = false; // Chage to "true" to check your system time for adjustments to $time_zone_adjust. Result will be echo'd to browser below ship date dropdown menu

$current_adjusted_hour = ($current_hour + $time_zone_adjust);

if($current_adjusted_hour <= $begin_cutoff_hour) {
        $date_offset = '0';
        }
    else {
        $date_offset = '1';
        }

for ($i=$date_offset, $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 ("%A %d %B %Y",$now[$i]).'</option>';
        }
}
?>
</select>
</fieldset>
<?PHP
if ($display_current_time == true) {
    echo "YOUR SYSTEM TIME IS $current_time";
    }
?>
<!-- Eof Ship Date -->


Change $display_current_time to true to see if the time output by the server/browser matches your time zone, and then adjust $time_zone_adjust as needed.

Let me know if this works for ya..
09 Apr 2008, 01:32
#8
pinixdesign avatar

pinixdesign

New Zenner

Join Date:
Aug 2006
Posts:
30
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

Thank you so much! It seems to be working great so far. I will test it tomorrow morning just to be sure. You are a life saver!
09 Apr 2008, 22:14
#9
duffy avatar

duffy

New Zenner

Join Date:
Aug 2005
Posts:
45
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

Hi mrmeech,

Don't mean to be a pest but I think I broke something on my install of this mod and maybe you can direct me to a fix.

In an effort to change the display of the ship date I changed the code in the
/includes/templates/YOURTEMPLATE/templates/tpl_checkout_shipping_default.php
file.

On the line to print the date I changed the order of Y , m, d to m, d, Y. It seemed to work fine, at least it shows the correct date order in the drop down at check out and displays the correct date order on the confirmation page as well. I also made this change in the emails and it displays properly there too.

But now I'm getting the date of 11/30/1999 in the orders list on the admin side for all orders, regardless of date selected. Could you guide me to what I need to correct?? And since I'm NOT a programmer, perhaps my approach is completely wrong.:shocking:
10 Apr 2008, 07:21
#10
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

duffy:

Hi mrmeech,

Don't mean to be a pest but I think I broke something on my install of this mod and maybe you can direct me to a fix.

In an effort to change the display of the ship date I changed the code in the
/includes/templates/YOURTEMPLATE/templates/tpl_checkout_shipping_default.php
file.

On the line to print the date I changed the order of Y , m, d to m, d, Y. It seemed to work fine, at least it shows the correct date order in the drop down at check out and displays the correct date order on the confirmation page as well. I also made this change in the emails and it displays properly there too.

But now I'm getting the date of 11/30/1999 in the orders list on the admin side for all orders, regardless of date selected. Could you guide me to what I need to correct?? And since I'm NOT a programmer, perhaps my approach is completely wrong.:shocking:


Well, changing that line of code can actually cause it to be inserted into the database record incorrectly, so it doesn't surprise me that you would wind up with something awkward happening. You could have also broken the date array that generates the list of dates... anyway, do some reading here if you're interested in learning about dates and mysql databases (i'm a strong encourager of learning): http://www.tizag.com/mysqlTutorial/mysql-date.php

What is it exactly that you want to do? Have the dropdown display the year at the end instead of the beginning of each date value?
10 Apr 2008, 14:23
#11
duffy avatar

duffy

New Zenner

Join Date:
Aug 2005
Posts:
45
Plugin Contributions:
0

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
10 Apr 2008, 14:47
#12
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

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!
10 Apr 2008, 15:24
#13
duffy avatar

duffy

New Zenner

Join Date:
Aug 2005
Posts:
45
Plugin Contributions:
0

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!!
11 Apr 2008, 02:47
#14
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

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
11 Apr 2008, 20:47
#15
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

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


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]
<!-- 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 -->
[/php]
11 Apr 2008, 21:21
#16
duffy avatar

duffy

New Zenner

Join Date:
Aug 2005
Posts:
45
Plugin Contributions:
0

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.
12 Apr 2008, 00:29
#17
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Posts:
60
Plugin Contributions:
0

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
12 Apr 2008, 02:34
#18
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

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]<?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 ?>[/php]
12 Apr 2008, 03:28
#19
mrmeech avatar

mrmeech

Zen Follower

Join Date:
Nov 2006
Posts:
248
Plugin Contributions:
0

Re: Order Delivery Date Support Thread

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]<!-- 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 -->[/php]
13 Apr 2008, 10:39
#20
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Posts:
60
Plugin Contributions:
0

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