本文整理汇总了PHP中CSaleLocation::AddLocationZIP方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::AddLocationZIP方法的具体用法?PHP CSaleLocation::AddLocationZIP怎么用?PHP CSaleLocation::AddLocationZIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleLocation
的用法示例。
在下文中一共展示了CSaleLocation::AddLocationZIP方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
$_SESSION["NUM_ZIP"] = $numZIP;
$bFinish = false;
$arReturn['STEP'] = 2;
$arReturn['AMOUNT'] = $amount;
$arReturn['POS'] = $cur_step;
break;
}
}
}
$DB->Commit();
if ($bFinish) {
unset($_SESSION["ZIP_POS"]);
$numCity = CSaleLocation::_GetZIPImportStats();
$strOK = GetMessage('SL_IMPORT_ZIP_STATS');
$strOK = str_replace('#NUMZIP#', intval($numZIP), $strOK);
$strOK = str_replace('#NUMCITIES#', intval($numCity["CITY_CNT"]), $strOK);
$arReturn['MESSAGE'] = $strOK;
$arReturn['STEP'] = 3;
$arReturn['PB_REMOVE'] = true;
break;
}
} else {
$arReturn['ERROR'] = GetMessage('SL_IMPORT_ERROR_NO_ZIP_FILE') . '<br>';
$arReturn['STEP'] = 3;
break;
}
break;
case 3:
$arReturn['COMPLETE'] = true;
break;
}
}
return $arReturn;
}
示例2: array
foreach($arLanguages as $langID)
{
$arArrayTmp[$langID] = array(
"LID" => $langID,
"NAME" => $shopLocation
);
}
$city_id = CSaleLocation::AddCity($arArrayTmp);
$location = CSaleLocation::AddLocation(
array(
"COUNTRY_ID" => $CurCountryID,
"CITY_ID" => $city_id
));
if($bRus)
CSaleLocation::AddLocationZIP($location, "101000");
WizardServices::IncludeServiceLang("step1.php", $lang);
}
COption::SetOptionString('sale', 'location', $location);
}
//Order Prop Group
if ($fizExist)
{
$dbSaleOrderPropsGroup = CSaleOrderPropsGroup::GetList(Array(), Array("PERSON_TYPE_ID" => $arGeneralInfo["personType"]["fiz"], "NAME" => GetMessage("SALE_WIZARD_PROP_GROUP_FIZ1")), false, false, array("ID"));
if ($arSaleOrderPropsGroup = $dbSaleOrderPropsGroup->GetNext())
$arGeneralInfo["propGroup"]["user_fiz"] = $arSaleOrderPropsGroup["ID"];
$dbSaleOrderPropsGroup = CSaleOrderPropsGroup::GetList(Array(),Array("PERSON_TYPE_ID" => $arGeneralInfo["personType"]["fiz"], "NAME" => GetMessage("SALE_WIZARD_PROP_GROUP_FIZ2")), false, false, array("ID"));
if ($arSaleOrderPropsGroup = $dbSaleOrderPropsGroup->GetNext())
$arGeneralInfo["propGroup"]["adres_fiz"] = $arSaleOrderPropsGroup["ID"];
示例3: time
$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;
$_SESSION["NUM_ZIP"] = $numZIP;
$bFinish = false;
$this->repeatCurrentService = true;
}
}
}