if(!isset($t_id) || !is_numeric($t_id) || (false === ($type = $db->selectObject( "select sub.* ". "from {$tblPref}SubCategory sub ". "inner join {$tblPref}Tours t ". "using (SubCat_ID) ". "where sub.Activated > 0 ". "and sub.SubCat_ID =".$t_id, __CFG_MOST_FREQUENT_CACHE_LIFETIME )))) { Object::raiseError("Invalid request parameters", __FILE__, __LINE__, E_USER_WARNING); $sid->assign("error", "strErrorInvalidRequestParameters"); Http::localRedirect("error"); } $tpl->assign("notice", $sid->assigned("notice") ? $sid->fetch("notice") : array()); if($sid->assigned("notice")) $sid->unassign("notice"); $tours = $db->selectObjects( "select t.*, min(p.Single) as Price ". "from {$tblPref}Tours t ". "inner join {$tblPref}SubCategory sb ". "using (SubCat_ID) ". "inner join {$tblPref}Category c ". "on (sb.Cat_ID = c.Cat_ID) ". "left outer join {$tblPref}ToursPrices p ". "on (t.Tour_ID = p.Tour_ID) ". "where t.SubCat_ID =".$type->SubCat_ID." ". "and t.Activated > 0 ". "group by t.Tour_ID", "Tour_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME ); if ($tours !== false) { foreach ($tours as $tid=>$t) { $year = date('y'); $valid_date = $year.'-04-01'; $query = "SELECT Single FROM {$tblPref}ToursPrices WHERE Tour_ID = ".$tid." AND ValidFrom >= '".$valid_date."' ORDER BY ValidFrom LIMIT 1"; $price = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($price !== false) { $tours[$tid]->Price = $price->Single; } } } foreach ($tours as $t_index=>$t_data) { $picID = $db->selectObject( "SELECT PicInfo_ID ". "FROM {$tblPref}ToursPicInfo ". "WHERE Tour_ID = ".$t_index." AND ". "PicNum = ".$t_data->PrimaryPic, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($picID === false) { $pic_ID = 0; } else { $pic_ID = $picID->PicInfo_ID; } $tours[$t_index]->PicID = $pic_ID; } if ($type->Cat_ID == 7) { foreach ($tours as $t_index=>$t_data) { $query = "SELECT Type_ID FROM {$tblPref}FlyDriveType WHERE Tour_ID = ".$t_index; $tour_type = $db->selectValue($query, "Type_ID"); if (empty($tour_type)) $tours[$t_index]->Type_ID = 1; else $tours[$t_index]->Type_ID = $tour_type; } } $tpl->assign("c_id", $type->Cat_ID); $cat_types = $db->selectObjects( "select * from {$tblPref}SubCategory ". "where Cat_ID =".$type->Cat_ID." order by ToolbarPosition asc", "SubCat_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME); $tpl->assign("cat_types", $cat_types); $tpl->assign("tours", $tours); ?> - Mini Tours
LT |  EN