public function getResourceFromService()
 {
     $params = $this->getState('params');
     $resourceId = $params['resourceId'];
     $resourceIdRef = $params['resourceId'];
     $options = array('path' => sprintf($this->urlResource, $resourceId), 'data' => array('$format' => 'json'));
     $url = $this->helper->getQuery($options);
     $cultureCode = JFactory::getLanguage()->getTag();
     $resource = null;
     $r = $this->helper->executeQuery($url);
     if (isset($r)) {
         $res = json_decode($r);
         //$resource = $res->d->results ?: $res->d;
         if (!empty($res->d->results)) {
             $resource = $res->d->results;
         } elseif (!empty($res->d)) {
             $resource = $res->d;
         }
         $resource->Merchant = BFCHelper::getMerchantFromServicebyId($resource->MerchantId);
         //		$resource->Services = $resource->OnSellUnit->Services;
         if (!empty($resource->ServiceIdList)) {
             $services = BFCHelper::GetServicesByIds($resource->ServiceIdList, $cultureCode);
             $resource->Services = $services;
             if (count($resource->Services) > 0) {
                 $tmpservices = array();
                 foreach ($resource->Services as $service) {
                     $tmpservices[] = $service->Name;
                 }
                 //					$services = implode(', ',$tmpservices);
             }
             $resource->Services = $services;
         }
     }
     return $resource;
 }
    if (isset($merchant->DistanceFromCenter)) {
        $distanceFromCenter = $merchant->DistanceFromCenter;
    }
}
$maxCapacityPaxes = $resource->MaxCapacityPaxes;
$minCapacityPaxes = $resource->MinCapacityPaxes;
$merchantRules = "";
if (isset($merchant->Rules)) {
    $merchantRules = BFCHelper::getLanguage($merchant->Rules, $language, null, array('ln2br' => 'ln2br', 'striptags' => 'striptags'));
}
$resourceRules = "";
if (isset($resource->Rules)) {
    $resourceRules = BFCHelper::getLanguage($resource->Rules, $language, null, array('ln2br' => 'ln2br', 'striptags' => 'striptags'));
}
if (!empty($resource->ServiceIdList)) {
    $services = BFCHelper::GetServicesByIds($resource->ServiceIdList, $language);
}
/*********************implementare ********************
*/
$PlanimetryData = $resource->PlanimetryData;
$showResourcePlanimetria = !empty($PlanimetryData);
// && stristr($PlanimetryData, 'image'));
$VideoData = $resource->VideoData;
$showResourceVideo = !empty($VideoData);
//$uri  = 'index.php?option=com_bookingforconnector&view=resource&layout=ratings&resourceId=' . $resource->ResourceId;
//$route = JRoute::_($uri);
$routeRating = '';
$formRoute = '';
?>
<div class="com_bookingforconnector_resource com_bookingforconnector_resource-mt<?php 
echo $merchant->MerchantTypeId;
        $cap = BFCHelper::getItem($addressData, 'cap');
        $comune = BFCHelper::getItem($addressData, 'comune');
        $provincia = BFCHelper::getItem($addressData, 'provincia');
    }
}
$uriMerchant = '';
$route = '';
$routeMerchant = '';
$resourceImageUrl = $base_url . '/sites/all/modules/bfi/images/default.png';
$merchantLogoPath = $base_url . '/sites/all/modules/bfi/images/default.png';
if ($merchant->LogoUrl != '') {
    $merchantLogoPath = BFCHelper::getImageUrlResized('merchant', $merchant->LogoUrl, 'merchant_logo_small_rapidview');
    $merchantLogoPathError = BFCHelper::getImageUrl('merchant', $merchant->LogoUrl, 'merchant_logo_small_rapidview');
}
if (!empty($resource->ServiceIdList)) {
    $services = BFCHelper::GetServicesByIds($resource->ServiceIdList);
}
$showdefault = false;
if (count($images) === 0) {
    $showdefault = true;
}
?>
<div style="max-width:870px;margin:auto;">
	<div class="row-fluid">
		<div class="span6">
		<?php 
if (!$showdefault) {
    ?>
			<div id="gallery" >
				<div id="sliderResource" class="flexslider">
					<ul class="slides">
	});
	//-->
	</script><!--  -->	
	<div class="com_bookingforconnector_merchantdetails-description">
		<h4 class="underlineborder"><?php 
echo JTEXT::_('COM_BOOKINGFORCONNECTOR_MERCHANTS_VIEW_MERCHANTDETAILS_DESC');
?>
</h4>
		<?php 
echo BFCHelper::getLanguage($merchant->Description, $this->language, null, array('ln2br' => 'ln2br', 'striptags' => 'striptags'));
?>
	</div>
	<?php 
$services = [];
if (!empty($merchant->ServiceIdList)) {
    $services = BFCHelper::GetServicesByIds($merchant->ServiceIdList, $this->language);
}
?>
	<?php 
if (!empty($services) && count($services) > 0) {
    ?>
	<div class="com_bookingforconnector_resource-services">
		<h4 class="underlineborder"><?php 
    echo JTEXT::_('COM_BOOKINGFORCONNECTOR_RESOURCE_VIEW_SERVICES');
    ?>
</h4>
		<?php 
    $count = 0;
    ?>
		<?php 
    foreach ($services as $service) {