A
A
Askfortrue2019-12-01 14:13:27
1C-Bitrix
Askfortrue, 2019-12-01 14:13:27

How to get the Character Code of the section that contains the element, given both the ID of this section and the ID of the element?

When printing print_r, there is an element ID and a section ID in which it is located, but the directory is built by CNC and the character code of the section in which the element is located is needed there.
All this is done to build the NC link before viewing the item in detail.
At the same time, [DETAIL_PAGE_URL] => #SITE_DIR#/1/2/3/#SECTION_CODE#/#ELEMENT_ID#/,
where 1,2,3 are index pages of different physical sections.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Askfortrue, 2019-12-01
@Askfortrue

Issue resolved if anyone is interested.

$res = CIBlockSection::GetByID($arElement["IBLOCK_SECTION_ID"]);
  if($ar_res = $res->GetNext()) {
    echo $ar_res['SECTION_PAGE_URL'];						  
  }

SECTION_PAGE_URL returns the entire path, as required.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question