本文整理汇总了PHP中Bitrix\Sale\Location\LocationTable::resetLegacyPath方法的典型用法代码示例。如果您正苦于以下问题:PHP LocationTable::resetLegacyPath方法的具体用法?PHP LocationTable::resetLegacyPath怎么用?PHP LocationTable::resetLegacyPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Location\LocationTable
的用法示例。
在下文中一共展示了LocationTable::resetLegacyPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stageConvertTree
protected function stageConvertTree()
{
if($this->getStep() == 0)
{
$this->migrator->convertTree();
$this->nextStep();
}
else
{
Location\LocationTable::resetLegacyPath();
$this->nextStage();
}
}
示例2: importFile
public static function importFile(&$descriptior)
{
$timeLimit = ini_get('max_execution_time');
if ($timeLimit < $descriptior['TIME_LIMIT']) {
set_time_limit($descriptior['TIME_LIMIT'] + 5);
}
$endTime = time() + $descriptior['TIME_LIMIT'];
if ($descriptior['STEP'] == 'rebalance') {
Location\LocationTable::resort();
Location\LocationTable::resetLegacyPath();
$descriptior['STEP'] = 'done';
}
if ($descriptior['STEP'] == 'import') {
if (!isset($descriptior['DO_SYNC'])) {
$res = \Bitrix\Sale\Location\LocationTable::getList(array('select' => array('CNT')))->fetch();
$descriptior['DO_SYNC'] = intval($res['CNT'] > 0);
}
if (!isset($descriptior['TYPES'])) {
$descriptior['TYPE_MAP'] = static::getTypeMap($descriptior['TYPE_FILE']);
$descriptior['TYPES'] = static::createTypes($descriptior['TYPE_MAP']);
$descriptior['SERVICE_MAP'] = static::getServiceMap($descriptior['SERVICE_FILE']);
$descriptior['SERVICES'] = static::getExistedServices();
}
$csvReader = new CSVReader();
$csvReader->LoadFile($descriptior['FILE']);
while (time() < $endTime) {
$block = $csvReader->ReadBlockLowLevel($descriptior['POS'], 100);
if (!count($block)) {
break;
}
foreach ($block as $item) {
if ($descriptior['DO_SYNC']) {
$id = static::checkLocationCodeExists($item['CODE']);
if ($id) {
$descriptior['CODES'][$item['CODE']] = $id;
continue;
}
}
// type
$item['TYPE_ID'] = $descriptior['TYPES'][$item['TYPE_CODE']];
unset($item['TYPE_CODE']);
// parent id
if (strlen($item['PARENT_CODE'])) {
if (!isset($descriptior['CODES'][$item['PARENT_CODE']])) {
$descriptior['CODES'][$item['PARENT_CODE']] = static::checkLocationCodeExists($item['PARENT_CODE']);
}
$item['PARENT_ID'] = $descriptior['CODES'][$item['PARENT_CODE']];
}
unset($item['PARENT_CODE']);
// ext
if (is_array($item['EXT'])) {
foreach ($item['EXT'] as $code => $values) {
if (is_array($values) && !empty($values)) {
if (!isset($descriptior['SERVICES'][$code])) {
$descriptior['SERVICES'][$code] = static::createService(array('CODE' => $code));
}
foreach ($values as $value) {
if (!strlen($value)) {
continue;
}
$item['EXTERNAL'][] = array('SERVICE_ID' => $descriptior['SERVICES'][$code], 'XML_ID' => $value);
}
}
}
}
unset($item['EXT']);
$res = Location\LocationTable::add($item, array('REBALANCE' => false, 'RESET_LEGACY' => false));
if (!$res->isSuccess()) {
throw new Main\SystemException('Cannot create location');
}
$descriptior['CODES'][$item['CODE']] = $res->getId();
}
}
if (!count($block)) {
unset($descriptior['CODES']);
$descriptior['STEP'] = 'rebalance';
}
}
return $descriptior['STEP'] == 'done';
}
示例3: DisplayList
try
{
$res = Helper::delete($id, true);
if(!$res['success'])
throw new Main\SystemException(Loc::getMessage('SALE_LOCATION_L_ITEM').' '.$id.' : '.implode('<br />', $res['errors']));
$DB->Commit();
}
catch(Main\SystemException $e)
{
$lAdmin->AddGroupError(Loc::getMessage('SALE_LOCATION_L_ITEM_DELETE_ERROR').": <br /><br />".$e->getMessage(), $id);
$DB->Rollback();
}
}
}
Location\LocationTable::resetLegacyPath();
}
$adminResult = Helper::getList($listParams, $sTableID);
$lAdmin->NavText($adminResult->GetNavPrint(Loc::getMessage('SALE_LOCATION_L_PAGES'), true)); // do not relocate the call relative to DisplayList(), or you`ll catch a strange nav bar disapper bug
}
catch(Main\SystemException $e)
{
$code = $e->getCode();
$fatal = $e->getMessage().(!empty($code) ? ' ('.$code.')' : '');
}
#####################################
#### PAGE INTERFACE GENERATION
#####################################
示例4: resetLegacyPath
public static function resetLegacyPath()
{
Helper::dropTable(self::TABLE_LEGACY_RELATIONS);
$dbConnection = \Bitrix\Main\HttpApplication::getConnection();
$dbConnection->query("create table " . self::TABLE_LEGACY_RELATIONS . " (\n\t\t\tID " . Helper::getSqlForDataType('int') . ",\n\t\t\tCOUNTRY_ID " . Helper::getSqlForDataType('int') . ",\n\t\t\tREGION_ID " . Helper::getSqlForDataType('int') . ",\n\t\t\tCITY_ID " . Helper::getSqlForDataType('int') . "\n\t\t)");
$dbConnection->query("insert into " . self::TABLE_LEGACY_RELATIONS . " (ID, COUNTRY_ID, REGION_ID, CITY_ID) select ID, COUNTRY_ID, REGION_ID, CITY_ID from b_sale_location");
Location\LocationTable::resetLegacyPath();
}
示例5: stageRestoreIndexes
protected function stageRestoreIndexes()
{
$indexes = array(
'IX_B_SALE_LOC_MARGINS',
'IX_B_SALE_LOC_MARGINS_REV',
//'IX_B_SALE_LOC_PARENT', // already restored at REBALANCE_WALK_TREE stage
'IX_B_SALE_LOC_DL',
'IX_B_SALE_LOC_TYPE',
'IX_B_SALE_LOC_NAME_NAME_U',
'IX_B_SALE_LOC_NAME_LI_LI',
'IX_B_SALE_LOC_EXT_LID_SID',
// old
'IXS_LOCATION_COUNTRY_ID',
'IXS_LOCATION_REGION_ID',
'IXS_LOCATION_CITY_ID',
);
if(isset($indexes[$this->getStep()]))
{
$this->restoreIndexes($indexes[$this->getStep()]);
$this->logMessage('Index restored: '.$indexes[$this->getStep()]);
$this->nextStep();
}
else
{
Location\LocationTable::resetLegacyPath(); // for backward compatibility
$this->nextStage();
}
}