Skip to content

Instantly share code, notes, and snippets.

@Ginnw2
Last active June 2, 2021 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Ginnw2/88bb697ff0d99a8b817edb0c7592a04e to your computer and use it in GitHub Desktop.
Save Ginnw2/88bb697ff0d99a8b817edb0c7592a04e to your computer and use it in GitHub Desktop.
Массовое создание свойств инфоблоков
<?$resB = CIBlock::GetList(
Array(),
Array(
'TYPE'=>'catalog'
), false
);
while($ar_res_blo = $resB->Fetch())
{
$iblon[] = $ar_res_blo['ID'];
}
// запустим цикл для создания свойств
foreach ($iblon as $iblon_id) {
// сформируем массив для создания свойства
$arFields = Array(
"NAME" => "Топ оптовых продаж",
"ACTIVE" => "Y",
"SORT" => "98",
"CODE" => "top_opt",
"PROPERTY_TYPE" => "L",
"IBLOCK_ID" => $iblon_id,
"SEARCHABLE" => "Y",
"LIST_TYPE" => "C",
"FILTRABLE" => "Y"
);
$arFields["VALUES"][0] = Array(
"VALUE" => "Да",
"DEF" => "N",
"SORT" => "100"
);
$ibp = new CIBlockProperty;
$PropID = $ibp->Add($arFields);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment