I
I
Irek Sitdikov2016-01-06 12:46:01
1C-Bitrix
Irek Sitdikov, 2016-01-06 12:46:01

How to create an information block in Bitrix?

Cannot create a new information block using the API.

$ib = new CIBlock;
$arFields = Array(
  "ACTIVE" => 'Y',
  "NAME" => 'Кирпичи',
  "CODE" => 'catalog_bricks',
  "LIST_PAGE_URL" => '#SITE_DIR#/catalog/list.php?SECTION_ID=#SECTION_ID#',
  "DETAIL_PAGE_URL" => '#SITE_DIR#/catalog/detail.php?ID=#ELEMENT_ID#',
  "IBLOCK_TYPE_ID" => 'catalog',
  "SITE_ID" => Array("ru"),
  "SORT" => 500,
  "PICTURE" => '',
  "DESCRIPTION" => '',
  "DESCRIPTION_TYPE" => '',
  "GROUP_ID" => Array("2"=>"D", "3"=>"R"),
);
$res = $ib->Add($arFields);

The result of the code returns emptiness.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Maksimenko, 2016-01-07
@olegprof

if (CModule::IncludeModule('iblock') {
    // some code
}

E
Evgeny Neverov, 2016-01-11
@deMone

Output $ib->LAST_ERROR after executing your code and look at the text of the error that Bitrix gives you. Correct the code according to the error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question