本文整理汇总了PHP中CSaleLocation::ClearAllLocationZIP方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::ClearAllLocationZIP方法的具体用法?PHP CSaleLocation::ClearAllLocationZIP怎么用?PHP CSaleLocation::ClearAllLocationZIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleLocation
的用法示例。
在下文中一共展示了CSaleLocation::ClearAllLocationZIP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CCSVData
include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/csv_data.php");
$csvFile = new CCSVData();
$csvFile->LoadFile($_SERVER['DOCUMENT_ROOT'].WIZARD_SERVICE_RELATIVE_PATH."/locations/ru/zip_ussr.csv");
$csvFile->SetFieldsType("R");
$csvFile->SetFirstHeader(false);
$csvFile->SetDelimiter(";");
if (is_set($_SESSION, 'ZIP_POS'))
{
$numZIP = $_SESSION["NUM_ZIP"];
$csvFile->SetPos($_SESSION["ZIP_POS"]);
}
else
{
CSaleLocation::ClearAllLocationZIP();
unset($_SESSION["NUM_ZIP"]);
$numZIP = 0;
}
$bFinish = true;
$arLocationsZIP = array();
$tt = 0;
$REGION = "";
while ($arRes = $csvFile->Fetch())
{
$tt++;
$CITY = $arRes[1];
if(strlen($arRes[3]) > 0)
$REGION = $arRes[3];
示例2: saleLocationImport
//.........这里部分代码省略.........
//echo '<script>Import('.($LOADZIP == "Y" ? 2 : 3).')</script>';
}
break;
case 2:
$time_limit = ini_get('max_execution_time');
if ($time_limit < ZIP_STEP_LENGTH) {
set_time_limit(ZIP_STEP_LENGTH + 5);
}
$start_time = time();
$finish_time = $start_time + ZIP_STEP_LENGTH;
if ($LOADZIP == "Y" && file_exists($sTmpFilePath . DLZIPFILE)) {
$rsLocations = CSaleLocation::GetList(array(), array("LID" => 'ru'), false, false, array("ID", "CITY_NAME_LANG", "REGION_NAME_LANG"));
$arLocationMap = array();
while ($arLocation = $rsLocations->Fetch()) {
if (strlen($arLocation["REGION_NAME_LANG"]) > 0) {
if (strlen($arLocation["CITY_NAME_LANG"]) > 0) {
$arLocationMap[$arLocation["CITY_NAME_LANG"]][$arLocation["REGION_NAME_LANG"]] = $arLocation["ID"];
}
} else {
$arLocationMap[$arLocation["CITY_NAME_LANG"]] = $arLocation["ID"];
}
}
$DB->StartTransaction();
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/csv_data.php";
$csvFile = new CCSVData();
$csvFile->LoadFile($sTmpFilePath . DLZIPFILE);
$csvFile->SetFieldsType("R");
$csvFile->SetFirstHeader(false);
$csvFile->SetDelimiter(";");
if (is_set($_SESSION, 'ZIP_POS')) {
$numZIP = $_SESSION["NUM_ZIP"];
$csvFile->SetPos($_SESSION["ZIP_POS"]);
} else {
CSaleLocation::ClearAllLocationZIP();
unset($_SESSION["NUM_ZIP"]);
$numZIP = 0;
}
$bFinish = true;
$tt = 0;
$REGION = "";
while ($arRes = $csvFile->Fetch()) {
$tt++;
$CITY = $arRes[1];
if (strlen($arRes[3]) > 0) {
$REGION = $arRes[3];
}
if (array_key_exists($CITY, $arLocationMap)) {
if (strlen($REGION) > 0) {
$ID = $arLocationMap[$CITY][$REGION];
} else {
$ID = $arLocationMap[$CITY];
}
} else {
$ID = 0;
}
if ($ID) {
CSaleLocation::AddLocationZIP($ID, $arRes[2]);
$numZIP++;
}
if ($tt == 10) {
$tt = 0;
$cur_time = time();
if ($cur_time >= $finish_time) {
$cur_step = $csvFile->GetPos();
$amount = $csvFile->iFileLength;
$_SESSION["ZIP_POS"] = $cur_step;