I have got a search plugin, which was developed for Joomla 2.5, the code in the search.php is as follows:
<?php
//To prevent accessing the document directly, enter this code:
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onSearch', 'plgSearchHotels' );
JPlugin::loadLanguage( 'plg_search_hotels' );
function &plgSearchHotelsAreas()
{
static $areas = array(
'hotels' => 'Hotels'
);
return $areas;
}
function plgSearchHotels ( $searchdate, $airport, $resort, $numadults, $numchild, $numinfants, $ordering='' )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$plugin =& JPluginHelper::getPlugin('search', 'hotels');
$searchdate = trim( $searchdate );
$numpassengers = $numadults + $numchild;
if ($searchdate == '') {
return array();
}
switch ( $ordering ) {
//alphabetic, ascending
case 'alpha':
$order = 'a.name ASC';
break;
//oldest first
case 'oldest':
//popular first
case 'popular':
//newest first
case 'newest':
//default setting: alphabetic, ascending
default:
$order = 'a.name ASC';
}
$searchHotels = JText::_( 'Hotels' );
$query = 'SELECT mykey, hotelName, resortName, dep, startDate, sellingPrice FROM Availability WHERE startDate = "'.$searchdate.'" AND available = "Y"';
if($airport !== "A") $query .= ' AND dep = "'.$airport.'"';
if($resort !== "A") $query .= ' AND resortCode = "'.$resort.'"';
$query .= ' AND seats >= '.$numpassengers;
$query .= ' AND beds >= '.$numpassengers.' ORDER BY sellingPrice ASC';
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
return $rows;
}
?>
However, when I try to use this code on Joomla 3.3, it's not working correctly. Any ideas what I'm doing wrong?