Your IP : 3.144.11.146


Current Path : /home/bitrix/ext_www/xn--80atde5a3i.com/search/
Upload File :
Current File : /home/bitrix/ext_www/xn--80atde5a3i.com/search/index.php

<?
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php");
$APPLICATION->SetTitle("Поиск по фразе: \"" . $_GET["q"]."\"");

$quote = "";
$page = "1";

if( !empty($_GET["q"]) ){
    $quote = $_GET["q"];
}
if( !empty($_GET["p"]) ){
    $page = $_GET["p"];
}

$categories  = array();
$products = array();

$arQuote = array();
$s = strlen($quote);

$arQuote[0] = $quote;
$arQuote[1] = substr($quote,-$s,$s-1);
$arQuote[2] = substr($quote,-$s,$s-2);
$arQuote[3] = substr($quote,-$s,$s-3);
$arQuote[4] = substr($quote,-$s,$s-4);

$arFilter = array('IBLOCK_ID' => 87,  "%NAME"=>$arQuote, "ACTIVE"=>"Y");
$rsSections = CIBlockSection::GetList(array('SORT' => 'ASC'), $arFilter, false,  array("*"), Array("nPageSize"=>52));

while ($arSection = $rsSections->GetNext()) {
//    if($arSection["PICTURE"])
    $categories [$arSection["ID"]] = array(
        "ID"=>$arSection["ID"],
        "NAME"=>$arSection["NAME"],
        "LINK"=>$arSection["SECTION_PAGE_URL"],
        "IMG"=>CFile::GetPath($arSection["PICTURE"])
    );
}



$arFilter1 = array('IBLOCK_ID' => 87, "%NAME"=>$arQuote, "ACTIVE"=>"Y");
$rsSections1 = CIBlockElement::GetList(array('SORT' => 'ASC'), $arFilter1, false,Array("iNumPage"=>$page,"nPageSize"=>52), array("*"));

while ($arSection1 = $rsSections1->GetNext()) {
    $ar_res = CCatalogProduct::GetByIDEx($arSection1["ID"]);
//    pre($ar_res);
    $imageUrl = "";

    if ($ar_res["PROPERTIES"]["MORE_PHOTO"]["VALUE"][0])
        $imageUrl = CFile::GetPath($ar_res["PROPERTIES"]["MORE_PHOTO"]["VALUE"][0]);

    if ($ar_res["PREVIEW_PICTURE"])
        $imageUrl = CFile::GetPath($ar_res["PREVIEW_PICTURE"]);


    if ($ar_res["DETAIL_PICTURE"])
        $imageUrl = CFile::GetPath($ar_res["DETAIL_PICTURE"]);


if($imageUrl != "" && $ar_res["PRICES"][1]["PRICE"] > 0 && $ar_res["NAME"]){

    if($ar_res["ID"]!= ""){
        $products [] = array(
            "ID"=>$ar_res["ID"],
            "NAME"=>$ar_res["NAME"],
            "LINK"=>$ar_res["DETAIL_PAGE_URL"],
            "IMG"=>$imageUrl,
            "PRICE"=>$ar_res["PRICES"][1]["PRICE"]
        );
    }
}



}
//pre($products);


?><!-- Breadcrumbs -->

<div class="breadcrumbs">
    <div class="container">
        <div class="row">
            <div class="col-xs-12">
                <ul>
                    <li class="home"><a title="Go to Home Page" href="/">Главная</a>»</li>
                    <li><strong>Поиск по фразе: "<?=$quote?>"</strong></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<!-- Breadcrumbs End -->
<!-- Main Container -->
<div class="main-container col1-layout">
    <div class="container">
        <div class="row">
            <div class="col-main col-sm-12 col-xs-12">
                <div class="shop-inner">
                    <div class="page-title">
                        <h2>Поиск: &nbsp;&nbsp;&nbsp;<span style="font-weight: 100">"<?=$quote?>"</span></h2>
                    </div>
                    <div class="product-grid-area">
                        <ul class="products-grid">

                            <?if($page==1):?>

                            <div class="my-account">
                                <div class="manufacturers-box">
                                    <?
                                    $counter = 0;
                                      foreach ($categories as $arItem): ?>
                                        <?
                                        $counter++;

                                        if ($counter == 1) {
                                            echo "<div class=\"row\">";
                                        }
                                        ?>
                                        <figure class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
                                            <a href="<?= $arItem["LINK"] ?>" class="jtv-m-logo-img">
                                                <img width="200" height="200" src="<?= $arItem["IMG"] ?>" alt="HTML template">
                                            </a>
                                            <figcaption>
                                                <h5><a href="<?= $arItem["LINK"] ?>"><?= $arItem["NAME"] ?></a></h5>
                                            </figcaption>

                                        </figure>


                                        <? if ($counter > 3) {
                                            echo "</div>";
                                            $counter = 0;
                                        }
                                        ?>


                                    <? endforeach; ?>


                                </div>
                            </div>
                            <?endif;?>

                            <?foreach ($products as $product):?>
                                <li class="item col-lg-3 col-md-4 col-sm-6 col-xs-6 ">
                                    <div class="product-item">
                                        <div class="item-inner" style="width: 261px;height: 261px">
                                            <div class="product-thumbnail">
                                                <div class="pr-img-area"> <a title="<?=$product["NAME"]?>" href="<?=$product["LINK"]?>">
                                                        <figure> <img alt="<?=$product["NAME"]?>" src="<?=$product["IMG"]?>" class="<?=$product["NAME"]?>"> <img alt="<?=$product["NAME"]?>" src="<?=$product["IMG"]?>" class="hover-img"></figure>
                                                    </a> </div>
                                                <div class="pr-info-area">
                                                    <div class="pr-button">
                                                        <div class="mt-button add_to_wishlist"> <a onclick="addToFavorites(<?= $product['ID'] ?>);"> <i class="fa fa-heart"></i> </a> </div>
                                                        <div class="mt-button add_to_compare"> <a onclick="addToCompare(<?= $product['ID'] ?>);"> <i class="fa fa-signal"></i> </a> </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="item-info">
                                                <div class="info-inner">
                                                    <div class="item-title"> <a title="<?=$product["NAME"]?>" href="<?=$product["LINK"]?>"><?=$product["NAME"]?> </a> </div>
                                                    <div class="item-content">
                                                        <div class="item-price">
                                                            <div class="price-box"> <span class="regular-price"> <span class="price"><?=$product["PRICE"]?> грн</span> </span> </div>
                                                        </div>
                                                        <div class="pro-action">
                                                            <button onclick="buyProduct(<?= $product['ID'] ?>, 1);" type="button" class="add-to-cart"> Купить </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            <?endforeach;?>



                        </ul>
                    </div>

                    <div class="pagination-area ">
                        <ul>
                            <?if($page==1):?>
                                <li><a class="active" href="#"><?=$page?></a></li>
                                <li><a href="/search/?q=<?=$quote?>&p=<?=$page+1?>"><i class="fa fa-angle-right"></i></a></li>
                            <?endif;?>

                            <?if($page>=2):?>
                                <li><a href="/search/?q=<?=$quote?>&p=<?=$page-1?>"><i class="fa fa-angle-left"></i></a></li>
                                <li><a class="active" ><?=$page?></a></li>
                                <li><a href="/search/?q=<?=$quote?>&p=<?=$page+1?>"><i class="fa fa-angle-right"></i></a></li>
                            <?endif;?>
                        </ul>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<!-- Main Container End -->




    <!-- service section -->
<?$APPLICATION->IncludeComponent(
	"bitrix:main.include",
	"",
	Array(
		"AREA_FILE_SHOW" => "file",
		"PATH" => SITE_DIR.'/include/pages/main/service_sec.php'
	)
);?><? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php"); ?>