Page 1 of 1

Can someone please help me.

Posted: Fri May 20, 2005 11:45 pm
by whalesale
I am trying to make a script that states when when an order will be shipped.

For example I do not ship orders recieved after 1:00pm EST on Friday through
3:00pm EST on Monday until 5:00pm on Monday.

#1 I would like a statement to come up for orders recieved between Friday 1:00pm and Sunday at 11:59pm EST that either that the customers order will ship on Monday (+ the date ie Monday May 23)unless that monday is a holiday where USPS or UPS is closed then see #3.


#2 If the order is placed between the hours of 12:00 midnight and 5:00pm Monday through Thursday their order will ship today (+ the date) unless it is a holiday then see #3


#3 p1 If their order is placed on a holiday before 5:00pm EST Monday through Friday 1:00pm when USPS or UPS is closed I would like a statement to come up to say that the day is a holiday and that their order will be shipped on the next day (+ the date).

or

#3 p2 If their order is placed on a holiday when USPS or UPS is closed that Monday I would like a statement to come up to say that because Monday is a holiday their order will not ship until Tursday (+ the date)

I am ok with editing code just not creating it.
I am willing to manually enter all holidays if required. (just tell me where to enter them)

Posted: Sat May 21, 2005 12:22 am
by infolock
what you need to look into is 2 simple functions. They are :

Date

and

Time

Posted: Sat May 21, 2005 1:21 am
by whalesale
Thank you so much for pointing me in the right direction.

Posted: Sat May 21, 2005 3:14 am
by whalesale
Ok here is what I have now

Code: Select all

<?php
//defne languages
define("TEXT_HOL_SHIP_MONDAY", "<B>Due to the holiday</B><br>Your order will ship on Monday");
define("TEXT_HOL_SHIP_TUESDAY", "<B>Due to the holiday</B><BR>Your order will ship on Tuesday");
define("TEXT_HOL_SHIP_MONDAY", "Your order will ship on <B>Monday</B>");
define("TEXT_HOL_SHIP_TUESDAY", "Your order will ship on <B>Tuesday</B>");
define("TEXT_HOL_SHIP_WEDNESDAY", "Your order will ship on <B>Wednesday</B>");
define("TEXT_HOL_SHIP_THURSDAY", "Your order will ship on <B>Thursday</B>");
define("TEXT_HOL_SHIP_FRIDAY", "Your order will ship on <B>Friday</B>");
define("TEXT_SHIP_TODAY", "If you place your order before <B>4:00pm Est</B><br>Your order will ship <B>Today</B>");
//holiday defines
$todaylong = date("F j");
if ($todaylong == 'May 30') { ${TODAY_HOLIDAY} = "hol1";}
elseif ($todaylong == 'July 4') { ${TODAY_HOLIDAY} = "hol2";}
elseif ($todaylong == 'September 5') { ${TODAY_HOLIDAY} = "hol3";}
elseif ($todaylong == 'October 10') { ${TODAY_HOLIDAY} = "hol4";}
elseif ($todaylong == 'November 24') { ${TODAY_HOLIDAY} = "hol5";}
elseif ($todaylong == 'November 25') { ${TODAY_HOLIDAY} = "hol6";}
elseif ($todaylong == 'December 26') { ${TODAY_HOLIDAY} = "hol7";}
elseif ($todaylong == 'January 2') { ${TODAY_HOLIDAY} = "hol8";}
else
$TODAY_HOLIDAY = ("false");
//regular shipping
$today = date("D");
$tme = date("g:i:s");
if ($today == 'Mon' && $TODAY_HOLIDAY == 'false' && $tme >= '16:00:00'){echo TEXT_SHIP_TODAY ;}
if ($today == 'Mon' && $TODAY_HOLIDAY == 'false' && $tme <= '16:00:00'){echo TEXT_SHIP_TUESDAY ;}
if ($today == 'Tue' && $TODAY_HOLIDAY == 'false' && $tme >= '16:00:00'){echo TEXT_SHIP_TODAY ;}
if ($today == 'Tue' && $TODAY_HOLIDAY == 'false' && $tme <= '16:00:00'){echo TEXT_SHIP_WEDNESDAY ;}
if ($today == 'Wed' && $TODAY_HOLIDAY == 'false' && $tme >= '16:00:00'){echo TEXT_SHIP_TODAY ;}
if ($today == 'Wed' && $TODAY_HOLIDAY == 'false' && $tme <= '16:00:00'){echo TEXT_SHIP_THURSDAY ;}
if ($today == 'Thu' && $TODAY_HOLIDAY == 'false' && $tme >= '16:00:00'){echo TEXT_SHIP_TODAY ;}
if ($today == 'Thu' && $TODAY_HOLIDAY == 'false' && $tme <= '16:00:00'){echo TEXT_SHIP_FRIDAY ;}
if ($today == 'Fri' && $TODAY_HOLIDAY == 'false' && $tme >= '13:00:00'){echo TEXT_SHIP_TODAY ;}
if ($today == 'Fri' && $TODAY_HOLIDAY == 'false' && $tme <= '13:00:00'){echo TEXT_SHIP_MONDAY ;}
if ($today == 'Sat' && $TODAY_HOLIDAY == 'false'){echo TEXT_SHIP_MONDAY ;}
if ($today == 'Sun' && $TODAY_HOLIDAY == 'false'){echo TEXT_SHIP_MONDAY ;}
//Holidays
if ($TODAY_HOLIDAY == 'hol1'){echo TEXT_HOL_SHIP_TUESDAY ;}
if ($TODAY_HOLIDAY == 'hol2'){echo TEXT_HOL_SHIP_TUESDAY ;}
if ($TODAY_HOLIDAY == 'hol3'){echo TEXT_HOL_SHIP_TUESDAY ;}
if ($TODAY_HOLIDAY == 'hol4'){echo TEXT_HOL_SHIP_TUESDAY ;}
if ($TODAY_HOLIDAY == 'hol5'){echo TEXT_HOL_SHIP_MONDAY ;}
if ($TODAY_HOLIDAY == 'hol6'){echo TEXT_HOL_SHIP_TUESDAY ;}
if ($TODAY_HOLIDAY == 'hol7'){echo TEXT_HOL_SHIP_TUESDAY ;}
if ($TODAY_HOLIDAY == 'hol8'){echo TEXT_HOL_SHIP_TUESDAY ;}
if ($TODAY_HOLIDAY == 'hol9'){echo TEXT_HOL_SHIP_MONDAY ;}
?>
Which works (dont really need the second precision but wth)
but how can I work in dates so for example a customer places an order on Sunday May 22nd I would like to not only tell the customer that their order will ship on Monday but Monday May 23?

TIA
Michael