Last active
June 2, 2021 13:23
-
-
Save Ginnw2/88bb697ff0d99a8b817edb0c7592a04e to your computer and use it in GitHub Desktop.
Массовое создание свойств инфоблоков
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?$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