Your IP : 3.149.228.234


Current Path : /home/bitrix/ext_www/klimatlend.ua/inc/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/inc/basket.php

<!-- Modal -->
<div class="modal fade bs-example-modal-sm" id="myBuyModal" aria-hidden="true">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="color: #51274d">
                    x
                </button>
                <span class="modal-title style-h4" id="myModalLabel"><?=GetMessage("TSB1_YOUR_CART")?></span>
            </div>
            <div class="body-modal">
                <? $APPLICATION->IncludeComponent(
                    "bitrix:sale.basket.basket",
                    ".default",
                    array(
                        "COUNT_DISCOUNT_4_ALL_QUANTITY" => "N",
                        "COLUMNS_LIST" => array(
                            0 => "NAME",
                            1 => "DISCOUNT",
                            2 => "PRICE",
                            4 => "SUM",
                            5 => "PROPS",
                            6 => "DELETE",
                            7 => "DELAY",
                        ),
                        "AJAX_MODE" => "N",
                        "AJAX_OPTION_JUMP" => "N",
                        "AJAX_OPTION_STYLE" => "Y",
                        "AJAX_OPTION_HISTORY" => "N",
                        "PATH_TO_ORDER" => "/personal/order/make/",
                        "HIDE_COUPON" => "N",
                        "QUANTITY_FLOAT" => "N",
                        "PRICE_VAT_SHOW_VALUE" => "N",
                        "TEMPLATE_THEME" => "site",
                        "SET_TITLE" => "N",
                        "AJAX_OPTION_ADDITIONAL" => "",
                        "OFFERS_PROPS" => array(
                        ),
                        "COMPONENT_TEMPLATE" => "climat_land_B",
                        "DEFERRED_REFRESH" => "N",
                        "USE_DYNAMIC_SCROLL" => "Y",
                        "SHOW_FILTER" => "N",
                        "SHOW_RESTORE" => "N",
                        "COLUMNS_LIST_EXT" => array(
                            0 => "PREVIEW_PICTURE",
                            1 => "DISCOUNT",
                            2 => "DELETE",
                            3 => "DELAY",
                            4 => "SUM",
                        ),
                        "COLUMNS_LIST_MOBILE" => array(
                            0 => "PREVIEW_PICTURE",
                            1 => "DISCOUNT",
                            2 => "DELETE",
                            3 => "DELAY",
                            4 => "SUM",
                        ),
                        "TOTAL_BLOCK_DISPLAY" => array(
                            0 => "bottom",
                        ),
                        "DISPLAY_MODE" => "compact",
                        "PRICE_DISPLAY_MODE" => "Y",
                        "SHOW_DISCOUNT_PERCENT" => "Y",
                        "DISCOUNT_PERCENT_POSITION" => "bottom-right",
                        "PRODUCT_BLOCKS_ORDER" => "props,sku,columns",
                        "USE_PRICE_ANIMATION" => "Y",
                        "LABEL_PROP" => array(),
                        "USE_PREPAYMENT" => "N",
                        "CORRECT_RATIO" => "Y",
                        "AUTO_CALCULATION" => "Y",
                        "ACTION_VARIABLE" => "basketAction",
                        "COMPATIBLE_MODE" => "Y",
                        "LABEL_PROP_MOBILE" => "",
                        "LABEL_PROP_POSITION" => "",
                        "ADDITIONAL_PICT_PROP_2" => "-",
                        "ADDITIONAL_PICT_PROP_6" => "MORE_PHOTO",
                        "ADDITIONAL_PICT_PROP_9" => "-",
                        "ADDITIONAL_PICT_PROP_10" => "-",
                        "BASKET_IMAGES_SCALING" => "adaptive",
                        "USE_GIFTS" => "Y",
                        "GIFTS_PLACE" => "BOTTOM",
                        "GIFTS_BLOCK_TITLE" => "Выберите один из подарков",
                        "GIFTS_HIDE_BLOCK_TITLE" => "N",
                        "GIFTS_TEXT_LABEL_GIFT" => "Подарок",
                        "GIFTS_PRODUCT_QUANTITY_VARIABLE" => "quantity",
                        "GIFTS_PRODUCT_PROPS_VARIABLE" => "prop",
                        "GIFTS_SHOW_OLD_PRICE" => "N",
                        "GIFTS_SHOW_DISCOUNT_PERCENT" => "Y",
                        "GIFTS_SHOW_NAME" => "Y",
                        "GIFTS_SHOW_IMAGE" => "Y",
                        "GIFTS_MESS_BTN_BUY" => "Выбрать",
                        "GIFTS_MESS_BTN_DETAIL" => "Подробнее",
                        "GIFTS_PAGE_ELEMENT_COUNT" => "4",
                        "GIFTS_CONVERT_CURRENCY" => "N",
                        "GIFTS_HIDE_NOT_AVAILABLE" => "N",
                        "USE_ENHANCED_ECOMMERCE" => "N"
                    ),
                    false
                ); ?>
            </div>




            <?
            CModule::IncludeModule("sale");
            $arID = array();
            $arBasketItems = array();
            $dbBasketItems = CSaleBasket::GetList(
                array(
                    "NAME" => "ASC",
                    "ID" => "ASC"
                ),
                array(
                    "FUSER_ID" => CSaleBasket::GetBasketUserID(),
                    "LID" => SITE_ID,
                    "ORDER_ID" => "NULL"
                ),
                false,
                false,
                array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "PRODUCT_PROVIDER_CLASS")
            );
            while ($arItems = $dbBasketItems->Fetch()) {
                if ('' != $arItems['PRODUCT_PROVIDER_CLASS'] || '' != $arItems["CALLBACK_FUNC"]) {
                    CSaleBasket::UpdatePrice($arItems["ID"],
                        $arItems["CALLBACK_FUNC"],
                        $arItems["MODULE"],
                        $arItems["PRODUCT_ID"],
                        $arItems["QUANTITY"],
                        "N",
                        $arItems["PRODUCT_PROVIDER_CLASS"]
                    );
                    $arID[] = $arItems["PRODUCT_ID"];
                }
            }

            $productCategories = array();
            $productids = array();
            foreach ($arID as $id){
                $product = CCatalogProduct::GetByIDEx($id);

                $productCategories [] = $product["IBLOCK_SECTION_ID"];
                $productids [] = $product["ID"];
            }


            //                pre1($productCategories);
            //                pre1($productids);


            $arrAllowedSections3 = array();
            $arGResult3 = getHighLoadBlockByName("RecomendedProducts", array(
                "select" => array("*"),
                "filter" => array('UF_CATEGORY' => $productCategories)
            ));
            foreach ($arGResult3 as $iblockAllowedSections) {
                $arrAllowedSections3 [] = $iblockAllowedSections;
            }
            $arGResult3 = getHighLoadBlockByName("RecomendedProducts", array(
                "select" => array("*"),
                "filter" => array('UF_ELEMENT' => $arID)
            ));
            foreach ($arGResult3 as $iblockAllowedSections) {
                $arrAllowedSections3 [] = $iblockAllowedSections;
            }
            //pre1($arrAllowedSections3);

            $products  = array();

            foreach ($arrAllowedSections3 as $items) {
                foreach ($items["UF_RECOM"] as $id) {
                    $product = CCatalogProduct::GetByIDEx($id);
                    if ($product["ACTIVE"] == "Y") {
                        $imageUrl = "";
//                            pre1($product);
                        if ($product["PREVIEW_PICTURE"] != "") {
                            $imageUrl = CFile::GetPath($product["PREVIEW_PICTURE"]);
                        } else {
                            if ($product["DETAIL_PICTURE"] != "")
                                $imageUrl = CFile::GetPath($product["DETAIL_PICTURE"]);
                            else {
                                if ($product["PROPERTIES"]["MORE_PHOTO"]["VALUE"] != "") {
                                    $imageUrl = CFile::GetPath($product["PROPERTIES"]["MORE_PHOTO"]["VALUE"]);
                                }
                            }
                        }
                        $products [] = array(
                            "ID" => $id,
                            "NAME" => $product["NAME"],
                            "IMG" => $imageUrl,
                            "LINK" => $product["DETAIL_PAGE_URL"],
                            "PRICE" => $product["PRICES"][1]["PRICE"],
                        );
                    }


                }
            }


            if (CModule::IncludeModule("sale"))
//Товары в корзине
                $arID = array();
            $arBasketItems = array();
            $dbBasketItems = CSaleBasket::GetList(
                array(
                    "NAME" => "ASC",
                    "ID" => "ASC"
                ),
                array(
                    "FUSER_ID" => CSaleBasket::GetBasketUserID(),
                    "LID" => SITE_ID,
                    "ORDER_ID" => "NULL"
                ),
                false,
                false,
                array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "PRODUCT_PROVIDER_CLASS")
            );

            $products0 = array();
            foreach ($products as $product){
                if(in_array($product["ID"],$productids)) continue;
                $products0 [] = $product;
            }
            $products = $products0;
            ?>
            <?if(!empty($products)):?>

                <div style="border-top: 1px solid #e4e6e8; min-height: 600px">
                    <br>
                    <div style="margin-left: 180px;"><h3> Товары которые Вам необходимы !</h3></div>
                    <? foreach ($products as $product):?>
                        <div class="col-md-4 col-sm-6 col-xs-12">
                            <div class="product__card" productid="<?= $product["ID"] ?>">
                                <div class="sticker__side">
                                    <div class="sticker__top"></div>
                                </div>
                                <a style="margin-bottom: 15px;" class="card__img"
                                   onclick="exEcomProductClick(product<?= $product["ID"] ?>,<?= $product["LINK"] ?>); return !ga.loaded;"
                                   href="<?= $product["LINK"] ?>">
                                    <img src="<?= $product["IMG"] ?>" alt="<?= $product["NAME"] ?>"
                                         title="<?= $product["NAME"] ?>" class="img-responsive">
                                    <span class="card__name"><?= $product["NAME"] ?></span>
                                </a>
                                <div class="card__coast" id="prices-4919">
                                    <div class="coast__new" style="margin-left: 40px;">
                                        <?= $product["PRICE"] ?> &nbsp; грн
                                    </div>
                                </div>
                                <span onclick="add2cart0(<?= $product["ID"] ?>,'Товар добавлен в корзину', 'ru')"
                                      style="margin-right: 15px;margin-top: -7px;" class="button__type--2 buy--prod"
                                      data-toggle="modal" data-target="#myBuyModal">Купить</span>
                            </div>
                        </div>
                    <? endforeach; ?>
                </div>
            <?endif;?>

        </div>
    </div>
</div>


<!-- Modal -->
<div class="modal fade bs-example-modal-sm" id="myBuyModal22" aria-hidden="true" style="z-index: 10000">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close one-click-close" data-target="#myBuyModal" data-dismiss="modal"
                        style="color: #52284e;" aria-hidden="true">×
                </button>
                <span class="modal-title style-h4" id="myModalLabel"> Быстрое оформления заказа</span>
            </div>
            <div class="body-modal">
                <div id="ocb-params" style="max-width: 300px;margin-left: 150px">
                    <br>
                    <h3>Заказать без оформления</h3>

                    Можно не заполнять никаких форм, просто оставить телефон, и консультант решит все вопросы по оформлению заказа
                    <input type="hidden" name="buyMode" value="ALL">

                    <div class="ocb-form-field">
                        <label class="control-label">Ваше имя                                                            <ins>*</ins>                        </label>
                        <input type="text" class="form-control" name="new_order[FIO]" value="" id="onecklick_name_myBuyModal22">
                        <div id="ocb-id-FIO-error" class="ocb-error-msg">Поле не должно быть пустым</div>

                    </div>

                    <div class="ocb-form-field">
                        <label class="control-label">Контактный телефон                                                            <ins>*</ins>                        </label>
                        <input type="text" class="form-control phone" onclick="mask();" name="new_order[PHONE]" value="" id="onecklick_phone_myBuyModal22">
                        <div id="ocb-id-PHONE-error" class="ocb-error-msg">Поле не должно быть пустым</div>

                    </div>

                    <div class="modal-footer">
                        <div class="send_form">

                            <input class="button__type--2" type="submit" value="Отправить заказ" id="onecklick_button" name="ocb_form_button">
                        </div>
                    </div>
                    <div class="ocb-form-loader"></div>
                </div>

            </div>
        </div>
    </div>
</div>
    <script>
        $("#onecklick_button").click(function () {
            var name = $("#onecklick_name_myBuyModal22").val();
            var phone = $("#onecklick_phone_myBuyModal22").val();

            var numb = phone.match(/\d/g);
            numb = numb.join("");


            $.ajax({
                method: "GET",
                url: "/ajax/onecklick.php?type=1",
                data: { name: name, phone: numb }
            })
                .done(function( msg ) {
                    window.location.href = "/personal/order/?type=1";
                });
        })
    </script>