Есть установщик готового решения расположен по /bitrix/wizards/softwarepass6454597test
В готовом решении есть импорт инфоблоков из xml
В файле types.php , который расположен по адресу /bitrix/wizards/softwarepass6454597test/swptest/site/services/iblock я задаю новый тип инфоблока и потом его прописываю в файлах portfolio.php potolki.php services.php . Тип называю "contentsoft"
Далее после установки решения все хорошо устанавливается, но вместо моего заданного типа инфоблока появляется другой тип с ID 1c_catalog - этот тип берет из ядра битрикса и в него записываются все нужные мне инфоблоки.
Ребят, где упускаю?
вот кодэ пример
types.php
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
die();
if(!CModule::IncludeModule("iblock"))
return;
$arTypes = Array(
Array(
"ID" => "contentsoft",
"SECTIONS" => "Y",
"IN_RSS" => "N",
"SORT" => 200,
"LANG" => Array(),
),
);
$arLanguages = Array();
$rsLanguage = CLanguage::GetList($by, $order, array());
while($arLanguage = $rsLanguage->Fetch())
$arLanguages[] = $arLanguage["LID"];
$iblockType = new CIBlockType;
foreach($arTypes as $arType)
{
$dbType = CIBlockType::GetList(Array(),Array("=ID" => $arType["ID"]));
if($dbType->Fetch())
continue;
foreach($arLanguages as $languageID)
{
WizardServices::IncludeServiceLang("type.php", $languageID);
$code = strtoupper($arType["ID"]);
$arType["LANG"][$languageID]["NAME"] = GetMessage($code."_TYPE_NAME");
$arType["LANG"][$languageID]["ELEMENT_NAME"] = GetMessage($code."_ELEMENT_NAME");
if ($arType["SECTIONS"] == "Y")
$arType["LANG"][$languageID]["SECTION_NAME"] = GetMessage($code."_SECTION_NAME");
}
$iblockType->Add($arType);
}
?>
type.php
<?
$MESS["CONTENTSOFT_TYPE_NAME"] = "Контент2";
$MESS["CONTENTSOFT_ELEMENT_NAME"] = "Элементы";
$MESS["CONTENTSOFT_SECTION_NAME"] = "Разделы";
?>
инфоблок
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
die();
if(!CModule::IncludeModule("iblock"))
return;
$iblockXMLFile = WIZARD_SERVICE_RELATIVE_PATH."/xml/".LANGUAGE_ID."/services.xml";
$iblockCode = "services".WIZARD_SITE_ID;
$iblockType = "contentsoft";
$rsIBlock = CIBlock::GetList(array(), array("CODE" => $iblockCode, "TYPE" => $iblockType));
$iblockID = false;
if ($arIBlock = $rsIBlock->Fetch())
{
$iblockID = $arIBlock["ID"];
if (WIZARD_REINSTALL_DATA)
{
CIBlock::Delete($arIBlock["ID"]);
$iblockID = false;
}
}
if($iblockID == false)
{
$permissions = Array(
"1" => "X",
"2" => "R"
);
$dbGroup = CGroup::GetList($by = "", $order = "", Array("STRING_ID" => "content_editor"));
if($arGroup = $dbGroup -> Fetch())
{
$permissions[$arGroup["ID"]] = 'W';
};
$iblockID = WizardServices::ImportIBlockFromXML(
$iblockXMLFile,
"services",
$iblockType,
WIZARD_SITE_ID,
$permissions
);
if ($iblockID < 1)
return;
//WizardServices::SetIBlockFormSettings($iblockID, Array ( 'tabs' => GetMessage("W_IB_GROUP_PHOTOG_TAB1").$REAL_PICTURE_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB2").$rating_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB3").$vote_count_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB4").$vote_sum_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB5").$APPROVE_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB6").$PUBLIC_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB7"), ));
//IBlock fields
$iblock = new CIBlock;
$arFields = Array(
"ACTIVE" => "Y",
"FIELDS" => array ( 'IBLOCK_SECTION' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'ACTIVE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y', ), 'ACTIVE_FROM' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '=today', ), 'ACTIVE_TO' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'SORT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'NAME' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => '', ), 'PREVIEW_PICTURE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array ( 'FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', ), ), 'PREVIEW_TEXT_TYPE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text', ), 'PREVIEW_TEXT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'DETAIL_PICTURE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array ( 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', ), ), 'DETAIL_TEXT_TYPE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text', ), 'DETAIL_TEXT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'XML_ID' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'CODE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'TAGS' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), ),
"CODE" => $iblockCode,
"XML_ID" => $iblockCode,
"NAME" => $iblock->GetArrayByID($iblockID, "NAME"),
//"NAME" => "[".WIZARD_SITE_ID."] ".$iblock->GetArrayByID($iblockID, "NAME")
);
$iblock->Update($iblockID, $arFields);
}
else
{
$arSites = array();
$db_res = CIBlock::GetSite($iblockID);
while ($res = $db_res->Fetch())
$arSites[] = $res["LID"];
if (!in_array(WIZARD_SITE_ID, $arSites))
{
$arSites[] = WIZARD_SITE_ID;
$iblock = new CIBlock;
$iblock->Update($iblockID, array("LID" => $arSites));
}
}
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH."/services/index.php", array("PROMOS_IBLOCK_ID" => $iblockID));
?>