Пример #1
0
define("NO_AGENT_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
$arResult = array();
if (!\Bitrix\Main\Loader::includeModule('sale')) {
    $arResult["ERROR"] = Loc::getMessage("SALE_SRV_LOCATION_CANT_INCLUDE_MODULE");
}
if (!isset($arResult["ERROR"]) && check_bitrix_sessid()) {
    $action = isset($_REQUEST['action']) ? trim($_REQUEST['action']) : '';
    $lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : LANGUAGE_ID;
    $countryIds = isset($_REQUEST['countryIds']) ? $_REQUEST['countryIds'] : array();
    switch ($action) {
        case "getRegionList":
            $arResult["DATA"] = \Bitrix\Sale\SalesZone::getRegions($countryIds, $lang);
            break;
        case "getCityList":
            $regionIds = isset($_REQUEST['regionIds']) && is_array($_REQUEST['regionIds']) ? $_REQUEST['regionIds'] : array();
            $arResult["DATA"] = \Bitrix\Sale\SalesZone::getCities($countryIds, $regionIds, $lang);
            break;
    }
} else {
    if (!isset($arResult["ERROR"])) {
        $arResult["ERROR"] = Loc::getMessage("SALE_SRV_LOCATION_ACCESS_DENIED");
    }
}
if (isset($arResult["ERROR"])) {
    $arResult["RESULT"] = "ERROR";
} else {
    $arResult["RESULT"] = "OK";
Пример #2
0
><?php 
                echo GetMessage("SMO_LOCATION_ALL");
                ?>
</option>
								<option value='NULL'<?php 
                echo in_array("NULL", $sales_zone_regions) ? " selected" : "";
                ?>
><?php 
                echo GetMessage("SMO_LOCATION_NO_REGION");
                ?>
</option>
								<?php 
                if (!in_array("", $sales_zone_countries)) {
                    ?>
									<?php 
                    $arRegions = SalesZone::getRegions($sales_zone_countries, LANGUAGE_ID);
                    ?>
									<?php 
                    foreach ($arRegions as $regionId => $arRegionName) {
                        ?>
										<option value="<?php 
                        echo $regionId;
                        ?>
"<?php 
                        echo in_array($regionId, $sales_zone_regions) ? " selected" : "";
                        ?>
><?php 
                        echo htmlspecialcharsbx($arRegionName);
                        ?>
</option>
									<?php