TechNOIR2019-06-04 15:30:52
TechNOIR, 2019-06-04 15:30:52

1C-Bitrix. How to get the full link to a section?

Good afternoon.
How to get the full link to a section?
I get a list of infoblock sections by filter.
But links to this sections are not given...

$arFilter1 = array('IBLOCK_ID' => 13, 'ACTIVE' => 'Y', 'UF_MAIN_CHECK' => '1',"TOP_DEPTH" => '1');
$arSections1 = CIBlockSection::GetTreeList($arFilter1);
if ($arSections1) {
while ($arSec = $arSections1->Fetch()) {

We get:
array(29) { ["ID"]=> string(5) "86454" ["TIMESTAMP_X"]=> string(19) "25.05.2019 11:08:55" ["MODIFIED_BY"]=> string(2) "61" ["DATE_CREATE"]=> string(19)
 "06.11.2018 18:22:47" ["CREATED_BY"]=> string(2) "61" ["IBLOCK_ID"]=> string(2) "13" ["IBLOCK_SECTION_ID"]=> string(5) "86453" ["ACTIVE"]=> string(1) "Y" 
["GLOBAL_ACTIVE"]=> string(1) "Y" ["SORT"]=> string(3) "500" ["NAME"]=> string(20) "Клавиатуры" ["PICTURE"]=> NULL ["LEFT_MARGIN"]=> string(2) "35" 
["RIGHT_MARGIN"]=> string(2) "36" ["DEPTH_LEVEL"]=> string(1) "3" ["DESCRIPTION"]=> string(0) "" ["DESCRIPTION_TYPE"]=> string(4) "text" ["SEARCHABLE_CONTENT"]=> 
string(22) "КЛАВИАТУРЫ " ["CODE"]=> string(10) "klaviatury" ["XML_ID"]=> string(0) "" ["TMP_ID"]=> NULL ["DETAIL_PICTURE"]=> NULL ["SOCNET_GROUP_ID"]=> NULL 
["LIST_PAGE_URL"]=> string(25) "#SITE_DIR#/bonus-catalog/" ["SECTION_PAGE_URL"]=> string(40) "#SITE_DIR#/bonus-catalog/#SECTION_CODE#/" ["IBLOCK_TYPE_ID"]=> 
string(7) "catalog" ["IBLOCK_CODE"]=> string(16) "goods for points" ["IBLOCK_EXTERNAL_ID"]=> string(9) "catalog-1" ["EXTERNAL_ID"]=> string(0) "" }

SECTION_PAGE_URL is it? For some reason, it is issued in this form ..
What am I doing wrong?
thanks in advance

Answer the question

In order to leave comments, you need to log in

3 answer(s)
2cha.headz, 2019-06-04

in the line "#SITE_DIR#/bonus-catalog/#SECTION_CODE#/"
#SITE_DIR# replace with constant SITE_DIR
#SECTION_CODE#/ replace $arSec['CODE']
or instead of Fetch() use GetNext() and everything will be replaced automatically))

Anton, 2019-06-04

<? require_once($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php");
$tree = CIBlockSection::GetTreeList(
$arFilter1 = array('IBLOCK_ID' => 13, 'ACTIVE' => 'Y', 'UF_MAIN_CHECK' => '1',"TOP_DEPTH" => '1'),
while($section = $tree->GetNext()) {
echo 'http://test.com/'.$section[CODE].'/';

What other section links? Section links are a set of character codes for section names.

Andrey Eskov, 2020-09-24

To get urls by template, you can use SetUrlTemplates

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question