コード例 #1
0
ファイル: index.php プロジェクト: DarneoStudio/bitrix
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";
}
/** @global CMain $APPLICATION */
if (strtolower(SITE_CHARSET) != 'utf-8') {
    $arResult = $APPLICATION->ConvertCharsetArray($arResult, SITE_CHARSET, 'utf-8');
コード例 #2
0
ファイル: options.php プロジェクト: webgksupport/alpina
" name="sales_zone_cities[<?php 
                echo $siteList[$i]["ID"];
                ?>
][]" multiple size="10" class="sale-options-location-mselect">
								<option value=''<?php 
                echo in_array("", $sales_zone_cities) ? " selected" : "";
                ?>
><?php 
                echo GetMessage("SMO_LOCATION_ALL");
                ?>
</option>
								<?php 
                if (!in_array("", $sales_zone_regions)) {
                    ?>
									<?php 
                    $arCities = SalesZone::getCities($sales_zone_countries, $sales_zone_regions, LANGUAGE_ID);
                    ?>
									<?php 
                    foreach ($arCities as $cityId => $cityName) {
                        ?>
										<option value="<?php 
                        echo $cityId;
                        ?>
"<?php 
                        echo in_array($cityId, $sales_zone_cities) ? " selected" : "";
                        ?>
><?php 
                        echo htmlspecialcharsbx($cityName);
                        ?>
</option>
									<?php