} } } } // go exist iblock $boolCatalogUpdate = false; if ($boolFlag) { $DB->StartTransaction(); $obCatalog = new CCatalog(); foreach ($arCurrentIBlocks as $intIBlockID => $arIBlockInfo) { $boolAttr = true; if (isset($arIBlockInfo['UNLINK']) && 'Y' == $arIBlockInfo['UNLINK']) { $boolFlag = $obCatalog->UnLinkSKUIBlock($arIBlockInfo['PRODUCT_IBLOCK_ID']); if ($boolFlag) { $arIBlockInfo['PRODUCT_IBLOCK_ID'] = 0; $arIBlockInfo['SKU_PROPERTY_ID'] = 0; $boolCatalogUpdate = true; } else { $boolFlag = false; $ex = $APPLICATION->GetException(); $strError = $ex->GetString(); $strWarning .= Loc::getMessage( 'CAT_IBLOCK_OFFERS_ERR_UNLINK_SKU', array( '#PRODUCT#' => $arIBlockInfo['INFO'],
$iblockType = "catalog"; $rsIBlock = CIBlock::GetList(array(), array("XML_ID" => $iblockCode, "TYPE" => $iblockType)); $IBLOCK_CATALOG_ID = false; if ($arIBlock = $rsIBlock->Fetch()) { $IBLOCK_CATALOG_ID = $arIBlock["ID"]; } else { $rsIBlock = CIBlock::GetList(array(), array("XML_ID" => "furniture_" . WIZARD_SITE_ID, "TYPE" => $iblockType)); if ($arIBlock = $rsIBlock->Fetch()) { $IBLOCK_CATALOG_ID = $arIBlock["ID"]; } } if (WIZARD_INSTALL_DEMO_DATA && $IBLOCK_CATALOG_ID) { $boolFlag = true; $arSKU = CCatalogSKU::GetInfoByProductIBlock($IBLOCK_CATALOG_ID); if (!empty($arSKU)) { $boolFlag = CCatalog::UnLinkSKUIBlock($IBLOCK_CATALOG_ID); if (!$boolFlag) { $strError = ""; if ($ex = $APPLICATION->GetException()) { $strError = $ex->GetString(); } else { $strError = "Couldn't unlink iblocks"; } //die($strError); } $boolFlag = CIBlock::Delete($arSKU['IBLOCK_ID']); if (!$boolFlag) { $strError = ""; if ($ex = $APPLICATION->GetException()) { $strError = $ex->GetString(); } else {
$strWarning .= str_replace(array('#ID#'), array($OF_IBLOCK_ID), GetMessage('IB_E_RIGHTS_IBLOCK_ACCESS_DENIED')) . '<br>'; $bVarsFromForm = true; } } if (!$bVarsFromForm) { $arSKUProp = CheckSKUProperty($ID, $OF_IBLOCK_ID); if ('OK' == $arSKUProp['RESULT']) { $intSKUPropID = $arSKUProp['VALUE']; } else { $bVarsFromForm = true; $strWarning .= $arSKUProp['MESSAGE'] . '<br>'; } } if (!$bVarsFromForm) { if (false !== $arCatalog && 0 < intval($arCatalog['OFFERS_IBLOCK_ID']) && $arCatalog['OFFERS_IBLOCK_ID'] != $OF_IBLOCK_ID) { $boolFlag = $obCatalog->UnLinkSKUIBlock($ID); } if (false === $arCatalog || $arCatalog['OFFERS_IBLOCK_ID'] != $OF_IBLOCK_ID) { $arOffersFields = array('IBLOCK_ID' => $OF_IBLOCK_ID, 'PRODUCT_IBLOCK_ID' => $ID, 'SKU_PROPERTY_ID' => $intSKUPropID); $arOFCatalog = CCatalog::GetByID($OF_IBLOCK_ID); if ($arOFCatalog) { $boolFlag = $obCatalog->Update($OF_IBLOCK_ID, $arOffersFields); } else { $boolFlag = $obCatalog->Add($arOffersFields); } } if ($ex = $APPLICATION->GetException()) { $strWarning .= $ex->GetString() . "<br>"; $bVarsFromForm = true; } }
$iblockXMLFile = WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/catalog.xml"; if ($shopLocalization == "ua") { $iblockXMLFilePrices = WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/catalog_prices_ua.xml"; } else { $iblockXMLFilePrices = WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/catalog_prices.xml"; } $iblockCode = "furniture_" . WIZARD_SITE_ID; $iblockType = "catalog"; $rsIBlock = CIBlock::GetList(array(), array("XML_ID" => $iblockCode, "TYPE" => $iblockType)); $iblockID = false; if ($arIBlock = $rsIBlock->Fetch()) { $iblockID = $arIBlock["ID"]; if (WIZARD_INSTALL_DEMO_DATA) { $arCatalog = CCatalog::GetByIDExt($arIBlock["ID"]); if (is_array($arCatalog) && in_array($arCatalog['CATALOG_TYPE'], array('P', 'X')) == true) { CCatalog::UnLinkSKUIBlock($arIBlock["ID"]); CIBlock::Delete($arCatalog['OFFERS_IBLOCK_ID']); } CIBlock::Delete($arIBlock["ID"]); $iblockID = false; COption::SetOptionString("eshop", "demo_deleted", "N", "", WIZARD_SITE_ID); $dbRes = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => 'IBLOCK_' . $arIBlock["ID"] . '_SECTION')); while ($arRes = $dbRes->Fetch()) { $userType = new CUserTypeEntity(); $userType->Delete($arRes["ID"]); } } } $dbResultList = CCatalogGroup::GetList(array(), array("CODE" => "BASE")); if (!$dbResultList->Fetch()) { $arFields = array();