Jump to content
Sign in to follow this  

Shipping Schedule

Recommended Posts


When ever I try changing anything in catalog/includes/classes/shipsched.php I get the following error on the checkout shipping page. if I leave it at the default it works fine.


Fatal error: Call to undefined function: earliestarrival() in catalog/includes/classes/shipsched.php on line 17


I am not changing the function. all I am trying to do is exclude Saturday and make next Wed the earlist day if you order after Wed.

here is the shipsched.php:

<?  class ShippingSchedule {  var $time_diff;  var $schedule;
 var $earliest_date;  var $charges; 	 function ShippingSchedule(){
  	 //Configure possible earliest delivery date for an order as follows.  This system
 //allows for complex situations where stores need variable amounts of preparation time,etc. 
 //as well as simpler schemes.
	 //The schedule array uses index 0-6 for each day of the week.  0 is sunday, 1 monday, etc., 
 //'start_time' is an integer representing the hour of the day (24 hour)    //Each day uses the previous day's 'target date' as the earliest
 //possible date to deliver on until the 'start_time' specified -- at that point    //it will use it's own 'target date' as the earliest delivery day.    //ex. an order at 12:25pm on Monday (schedule[1]), the earliest possible day to deliver  
 //will be 3 (Wednesday), but after 13:00 on Monday, the earliest poss. day will be 4 (Thurs).
   //A start time of 0 would indicate to always use the current day's 'target day'.  In this example,
 //any order on Sunday would have an earliest delivery date of Wednesday.    $this->schedule[0]=array('start_time'=>0,'target_day'=>3); 	 $this->schedule[1]=array('start_time'=>13,'target_day'=>4); 	 $this->schedule[2]=array('start_time'=>13,'target_day'=>5); 	 $this->schedule[3]=array('start_time'=>13,'target_day'=>6); 	 $this->schedule[4]=array('start_time'=>15,'target_day'=>2); 	 $this->schedule[5]=array('start_time'=>0,'target_day'=>2); 	 $this->schedule[6]=array('start_time'=>14,'target_day'=>3);  }  function EarliestArrival(){ 	 $current_day=date('w'); 	 $current_time=date('G'); //any time of the hour will be considered past the hour 	 $prev_day=($current_day!=0) ? $current_day-1 : 6; 	 $target=($current_time>=$this->schedule[$current_day]['start_time']) ? $this->schedule[$current_day]['target_day'] : $this->schedule[$prev_day]['target_day']; 	 $days_needed=($current_day<=$target) ? $target-$current_day : (7-$current_day)+$target; 	 $this->earliest_date=mktime(0,0,0,date('m'),date('d')+$days_needed,date('Y'));  }  function DateStillValid($shipdate){ 	 if(!isset($this->earliest_date))$this->EarliestArrival(); 	 $result=($this->earliest_date>$shipdate) ? false : true; 	 return $result; 	 }  function DateInfo($datestamp){
 //This functions returns an array containing info about whether a date is valid for delivery
 //and the CSS class for the calendar.  The classes are defined in calendar.css

 //Currently Sunday is considered invalid and Saturday is a different class, 
 //although for now its class is defined the same as other valid days.
  	 if(!isset($this->earliest_date))$this->EarliestArrival(); 	 if($datestamp>=$this->earliest_date){    if(date('w',$datestamp)==6){   	 $result['valid']=true;   	 $result['class']='s_valid';    }elseif(date('w',$datestamp)==0){   	 $result['valid']=false;      $result['class']='invalid';    }else{   	 $result['valid']=true;   	 $result['class']='valid';    } 	 }else{    $result['valid']=false;    $result['class']='invalid'; 	 } 	 return $result;  }
} ?>



Thanks for any help you can give


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this