avdesigns Posted October 8, 2013 Report Share Posted October 8, 2013 Hello! I am just wondering if somebody could tell me the code for the following options on the flight search (simpilot): Flight times so show flights between 5 and 7 hours Show flights on a particular day. Thanks! Jacob Quote Link to comment Share on other sites More sharing options...
freshJet Posted October 8, 2013 Report Share Posted October 8, 2013 I have tried getting schedules with a min/max flight time but the problem is that you'll need to edit the getSchedules function. Instead I recommend you create a new one. It's best to make a new class for it, create a new file in core/common and call it something along the lines of ScheduleSearch.class.php. This way, when you update, it won't get overwritten. Anyway, you could do this for the flight time: public function getSchedulesByDuration($min, $max){ $sql = "SELECT * FROM ".TABLE_PREFIX."_schedules"; WHERE flighttime >= '".$min."' AND flighttime <= '".$max."'; return DB::get_results($sql); } Obviously you'll need to pass the min and max values in when you use it. As for the day of week: public function getSchedulesByDayofWeek($dayofweek){ $sql = "SELECT * FROM ".TABLE_PREFIX."_schedules"; WHERE daysofweek LIKE '".$dayofweek."'; return DB::get_results($sql); } Remember that the value passed into that one must be a number, you could use a CASE or IF statement to assign each number to a day for the user to enter. Quote Link to comment Share on other sites More sharing options...
Ashj24uk Posted October 8, 2013 Report Share Posted October 8, 2013 This is great Just wondering how you can implement it into the templeates Quote Link to comment Share on other sites More sharing options...
freshJet Posted October 8, 2013 Report Share Posted October 8, 2013 $flights = ScheduleSearch::getSchedulesByDuration(5, 7); foreach($flights as $flight){ do stuff here... } This is only if you want to specify the min/max. If you want the user to specify it, assign them to the field names in the form. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.