/**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 protected function getOptions()
 {
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $masterTypologies = BFCHelper::getMasterTypologies();
     $options = array();
     if ($masterTypologies) {
         foreach ($masterTypologies as $masterTypology) {
             $options[] = JHtml::_('select.option', $masterTypology->MasterTypologyId, BFCHelper::getLanguage($masterTypology->Name, $language));
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
$language = $language;
$uri = 'index.php?option=com_bookingforconnector&view=search';
$db->setQuery('SELECT id FROM #__menu WHERE link LIKE ' . $db->Quote($uri . '%') . ' AND language=' . $db->Quote($language) . ' AND published = 1 LIMIT 1');
$itemId = $db->getErrorNum() ? 0 : intval($db->loadResult());
if ($itemId != 0) {
    $formAction = JRoute::_('index.php?Itemid=' . $itemId . '');
} else {
    $formAction = JRoute::_($uri);
}
// setting per slider prezzi
$priceScaleMin = 0;
$priceScaleMax = 300;
$priceScaleStep = 50;
//zone...
$locationZones = BFCHelper::getLocationZones();
$masterTypologies = BFCHelper::getMasterTypologies();
// elenco ulteriore filtri possibili
$merchantGroups = BFCHelper::getTags($language, "1,4");
$bookingTypes = array();
//$bookingTypes[0] = JTEXT::_('MOD_BOOKINGFORSEARCHFILTER_BOOKINGTYPES_REQUEST');
$bookingTypes[1] = JTEXT::_('MOD_BOOKINGFORSEARCHFILTER_BOOKINGTYPES_BOOK');
$offers = array();
$offers[1] = JTEXT::_('MOD_BOOKINGFORSEARCHFILTER_OFFERS_OFFER');
$pars = BFCHelper::getSearchParamsSession();
// se  passo questi dati è una nuova ricerca
$masterTypeId = $pars['masterTypeId'];
$merchantCategoryId = $pars['merchantCategoryId'];
// TODO: SUSPENDED
//if (!empty($merchantCategoryId)) {
//
////	$singeMerchantCategory = BFCHelper::getMerchantCategory($merchantCategoryId);
/*
$checkin = $pars['checkin'] ?: $startDate ;
$checkout = $pars['checkout'] ?: $startDate2 ;
$paxes = $pars['paxes'] ?: 2;
$masterTypeId = $pars['masterTypeId']?: '';
$zoneId = $pars['zoneId']?: 0;
$resourceName = $pars['resourceName'] ?: '';
$refid = $pars['refid']?: '';
$onlystay = $pars['onlystay']?: 'true';
$pricerange = $pars['pricerange']?: '0';
*/
//if ($pars['checkout'] == null)
//	$checkout->modify($checkoutspan);
$document = JFactory::getDocument();
$language = $document->getLanguage();
$merchantCategories = BFCHelper::getMasterTypologies();
$types = array();
$types[] = JHTML::_('select.option', '', '---');
foreach ($merchantCategories as $mc) {
    $types[] = JHTML::_('select.option', $mc->MasterTypologyId, BFCHelper::getLanguage($mc->Name, $language));
}
$persons = array(JHTML::_('select.option', '1', JText::_('1')), JHTML::_('select.option', '2', JText::_('2')), JHTML::_('select.option', '3', JText::_('3')), JHTML::_('select.option', '4', JText::_('4')), JHTML::_('select.option', '5', JText::_('5')), JHTML::_('select.option', '6', JText::_('6')), JHTML::_('select.option', '7', JText::_('7')), JHTML::_('select.option', '8', JText::_('8')), JHTML::_('select.option', '9', JText::_('9')), JHTML::_('select.option', '10', JText::_('10')));
$prices = array(JHTML::_('select.option', '0', JTEXT::_('MOD_BOOKINGFORCONNECTOR_SEARCH_ALL')), JHTML::_('select.option', '1|199', '< 200 €'), JHTML::_('select.option', '200|399', '200 - 399 €'), JHTML::_('select.option', '400|599', '400 - 599 €'), JHTML::_('select.option', '600|799', '600 - 799 €'), JHTML::_('select.option', '800|999', '800 - 999 €'), JHTML::_('select.option', '1000|1499', '1000 - 1499 €'), JHTML::_('select.option', '1500|0', '> 1500 €'));
//$zones =  array(
//	JHTML::_('select.option', '0', 'Bibione' ),
//	JHTML::_('select.option', '1', 'Bibione Spiaggia' ),
//	JHTML::_('select.option', '2', 'Bibione Pineda' ),
//	JHTML::_('select.option', '3', 'Bibione Lido del Sole' ),
//	JHTML::_('select.option', '4', 'Bibione Lido dei Pini' ),
//	JHTML::_('select.option', '5', 'Bevazzana' )
//	);
    $checkout->modify($checkoutspan);
}
if ($isportal) {
    // if is portal are used Merchant's Categories else are used Product's Categories by merchant in api key
    $merchantCategories = BFCHelper::getMerchantCategoriesForRequest($language);
    $merchantCategoriesString = '';
    $merchantCategories = is_array($merchantCategories) ? $merchantCategories : array();
    foreach ($merchantCategories as $mc) {
        if ($mc->MerchantCategoryId == $merchantCategoryId) {
            $merchantCategoriesString = $merchantCategoriesString . '<option value="' . $mc->MerchantCategoryId . '" selected>' . $mc->Name . '</option>';
        } else {
            $merchantCategoriesString = $merchantCategoriesString . '<option value="' . $mc->MerchantCategoryId . '">' . $mc->Name . '</option>';
        }
    }
} else {
    $masterTypologies = BFCHelper::getMasterTypologies(true, $language);
    $masterTypologiesString = '';
    $masterTypologies = is_array($masterTypologies) ? $masterTypologies : array();
    foreach ($masterTypologies as $mc) {
        if ($mc->MasterTypologyId == $masterTypeId) {
            $masterTypologiesString = $masterTypologiesString . '<option value="' . $mc->MasterTypologyId . '" selected>' . $mc->Name . '</option>';
        } else {
            $masterTypologiesString = $masterTypologiesString . '<option value="' . $mc->MasterTypologyId . '">' . $mc->Name . '</option>';
        }
    }
}
$nad = 0;
$nch = 0;
$nse = 0;
if (empty($paxages)) {
    $nad = 2;