Ofertas

Descuentos de hasta un 40%

Para más información, contacte en reservations@villasholidayscostablanca.com

				
					<div id="avantio-desc">
<?php
                function getContentDataRaw($urlContent) {
                    $ch = curl_init();
                    curl_setopt($ch, CURLOPT_URL, $urlContent);
                    curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
                    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                    $data = curl_exec($ch);
                    $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                    if ($code != 200) {
                        curl_close($ch);
                        return null;
                    }
                    curl_close($ch);

                    return json_decode($data, true);
                }

                $data = getContentDataRaw("https://crs.avantio.com/getListaOfertas.php?bk=bk_holicostablanc&Idioma=ES&idCurrency=978");
            ?>
            <? 
        $uri = parse_url($_SERVER['REQUEST_URI']);
        parse_str($uri['query'], $params);
        $page = ($params['page']) ? $params['page'] : 1;
        
        $limit = 12;
        $start = ($page - 1) * $limit; 
        $total = count($data);
        $totalPages = ceil($total / $limit);

        $startPages = $page - 2;
        $endPages = $page + 2;

        if ($startPages <= 0) {
            $startPages = 1;
            $endPages = $page + 4;
        }

        if ($endPages > $totalPages) {
            $endPages = $totalPages;

            if ($startPages > 1) {
                $startPages = $endPages - 4;
            }
        }

        if ($endPages < $totalPages && $totalPages > 5 && $endPages < 5) {
            $endPages = 5;
        }

        if ($page == $totalPages && ($page - 4 > 0 )) {
            $startPages = $page - 4;
        }

        $previousPage = ($page > 1) ? "<div class='previous-page'><a href='?page=" . ($page - 1) . "'><i class='icon icon-left-open'></i></a></div>" : "";
        $nextPage = ($page < $totalPages) ? "<div class='next-page'><a href='?page=" . ($page + 1) . "'><i class='icon icon-right-open'></i></a></div>" : "";

        $data = array_slice($data, $start, $limit);
        ?>
        
        <div class="slider-viewport">
            <ul class="slider-row">
            <?  $cont = 0;
                foreach ($data as $ofertaEspecial):
                $cont++;
                $discountAmount = $ofertaEspecial['discount']['amount'];
                $discountType = $ofertaEspecial['discount']['type'];
                $lastMinute = $ofertaEspecial['discount']['lastMinute'];?>

                <li class="slide-box">
                    <a href="<? echo $ofertaEspecial['urlFicha']; ?>">
                        <img class="oferta-especial-bg" src="<? echo $ofertaEspecial['imageUrl'];?>">
                        <span class="overlay-bg"></span>
                        <ul class="oferta-especial-title">
                            <? if (!is_null($ofertaEspecial['title'])) { ?>
                            <li class="oferta-especial-name"><? echo $ofertaEspecial['title']; ?></li>
                            <? } else { ?>
                            <li class="oferta-especial-name"><? echo $ofertaEspecial['name']; ?></li>
                            <li class="oferta-especial-town"><? echo $ofertaEspecial['locality']; ?></li>
                            <? } ?>
                        </ul>
                        <span class="oferta-especial-price">
                            <? echo $ofertaEspecial['basePriceText']['precio'] . $ofertaEspecial['basePriceText']['desde'] . $ofertaEspecial['basePrice'] . " " . $ofertaEspecial['basePriceText']['noche'] ; ?>
                        </span>
                        <ul class="oferta-especial-rooms">
                            <li class="oferta-especial-people"><span class="icon icon-user-o"></span><? echo $ofertaEspecial['capacity']; ?></li>
                            <? if($ofertaEspecial['bedrooms'] || $ofertaEspecial['bedrooms'] !== 0) { ?>
                            <li class="oferta-especial-bed"><span class="icon icon icon-camas"></span><? echo $ofertaEspecial['bedrooms']; ?></li>
                            <? } ?>
                        </ul>
                        <? if (!$lastMinute) { ?>
                            <ul class="oferta-especial-data">
                            <li class="oferta-especial-date"><? echo " " . $ofertaEspecial['discount']['i18n']['i18nValidOffer'] . " " . $ofertaEspecial['discount']['startDate'] . " | " . $ofertaEspecial['discount']['endDate']; ?></li>
                            </ul>
                        <? } ?>
                        <? if ($discountType && ($discountAmount != null)) { ?>
                            <div class="oferta-especial-descuento <? echo ($lastMinute) ? 'oferta-especial-descuento--last-minute' : ''; ?>">
                            <span class="oferta-especial-texto"><? echo ($lastMinute) ? $ofertaEspecial['discount']['i18n']['i18nLastMinute'] : $ofertaEspecial['discount']['i18n']['i18nAplicarDescuento']; ?></span>
                            <? if ($discountType == 'DAYS') { ?>
                                <span class="oferta-especial-cantidad"><? echo $discountAmount . ' ' . $ofertaEspecial['discount']['typeText']; ?></span>
                            <? } ?>
                            <? if ($discountType == 'PERCENTAGE') { ?>
                                <span class="oferta-especial-cantidad porcentaje-descuento"><span class="texto-hasta-descuento"><?=$ofertaEspecial['discount']['i18n']['i18nTextoHasta']?></span> <span class="cantidad-descuento"><? echo $discountAmount . ' %'?></span></span>
                            <? } ?>
                            <? if ($discountType == 'MONEY') { ?>
                                <span class="oferta-especial-cantidad porcentaje-descuento"><span class="texto-hasta-descuento"><?=$ofertaEspecial['discount']['i18n']['i18nTextoHasta']?></span> <span class="cantidad-descuento"></span><? echo $discountAmount; ?></span></span>
                            <? } ?>
                            </div>
                        <? } ?>
                    </a>
                </li>
            
            <? endforeach; ?>
            </ul>
        </div>
        
        <div id="pagination">
            <div class="info-pagination">
                <span><?=$data[0]['discount']['i18n']['i18nInfoPagination1']?> <?=$start + 1?> - <?=$start + count($data)?>  <?=$data[0]['discount']['i18n']['i18nInfoPagination2']?>  <?=$total?> <?=$data[0]['discount']['i18n']['i18nInfoPagination3']?></span>
            </div>
            <div class="links-pagination">
                <?=$previousPage?>
                <div class=links>
                    <? for ($i = $startPages; $i <= $endPages; $i ++) { 
                        if ($page == $i) { ?>
                            <b><?=$i?></b>
                        <? continue; } ?>

                        <a href="?page=<?=$i?>"><?=$i?></a>
                    <? } ?>
                </div>
                <?=$nextPage?>
            </div>
        </div>
        </div>
				
			

Para más información, contacte en reservations@villasholidayscostablanca.com

Plaza Benimarco 3 | 03725 Teulada ( Alicante) | Tel/Fax 966 498 760 Email rentals@villasholidayscostablanca.com Villas Holidays Costa Blanca | 2019- 2019 Todos los derechos reservados – Gestor Turístico EGVT-658-A – Constructora de confianza Cresmarta
0/5 (0 Reviews)
Abrir chat