• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/vk/catalogsectiontabhandler.php
  • Класс: Bitrix\Sale\TradingPlatform\Vk\CatalogSectionTabHandler
  • Вызов: CatalogSectionTabHandler::action
public function action($arArgs)
{
	$sectionId = $arArgs["ID"];
	$vk = Vk::getInstance();
	$exportProfiles = $vk->getExportProfilesList();

	foreach ($exportProfiles as $export)
	{
		$dataToMapping = array();
		$dataToDelete = array();

		$sectionsList = new SectionsList($export["ID"]);
//			in moment of changes setting we must drop cached sections and mapped sections
		$sectionsList->clearCaches();
		$sectionsList->setCurrSectionSettings($_POST['VK_EXPORT'][$export["ID"]]);

//			formatted or remove current section
		$preparedSection = $sectionsList->prepareSectionToSave($sectionId);
		$dataToMapping += $preparedSection['TO_SAVE'] ? $preparedSection['TO_SAVE'] : array();
		$dataToDelete += $preparedSection['TO_DELETE'] ? $preparedSection['TO_DELETE'] : array();

//			save or remove childs
		$preparedChilds = $sectionsList->prepareChildsToSave($sectionId);
		$dataToMapping += $preparedChilds['TO_SAVE'] ? $preparedChilds['TO_SAVE'] : array();
		$dataToDelete += $preparedChilds['TO_DELETE'] ? $preparedChilds['TO_DELETE'] : array();

		if (!empty($dataToMapping))
		{
			Map::updateSectionsMapping($dataToMapping, $export["ID"], 'ONLY_INTERNAL');
		}

		if (!empty($dataToDelete))
		{
			Map::removeSectionsMapping($dataToDelete, $export["ID"], 'ONLY_INTERNAL');
		}
	}

	return true;
}