if ( $_REQUEST["array"] ) { //debug message echo "Array sort completed"; exit(); } require( $_SERVER[ 'DOCUMENT_ROOT' ] .'/bitrix/modules/main/include/prolog_before.php' ); CModule::IncludeModule( 'iblock' ); if( !intval( $_GET[ 'company' ] ) ) : exit; endif; $sort = array( 'SORT' => 'ASC' ); $filter = array( 'IBLOCK_CODE' => 'companies', 'ID' => intval( $_GET[ 'company' ] ), 'ACTIVE' => 'Y' ); $select = array( 'ID', 'NAME', 'CODE', 'PREVIEW_PICTURE', 'DETAIL_PICTURE' ); if( !$company = CIBlockElement::GetList( $sort, $filter, false, false, $select ) -> Fetch() ) : exit; endif; $filter = array( 'IBLOCK_ID' => 9, 'UF_COMPANY' => $company[ 'ID' ], 'DEPTH_LEVEL' => 1, 'ACTIVE' => 'Y' ); $select = array( 'ID' ); if( !$menu = CIBlockSection::GetList( $sort, $filter, false, $select ) -> Fetch() ) : exit; endif; $cats = array(); $filter = array( 'IBLOCK_CODE' => 'menues', 'SECTION_ID' => $menu[ 'ID' ], 'DEPTH_LEVEL' => 2, 'ACTIVE' => 'Y' ); $select = array( 'ID', 'NAME' ); $list = CIBlockSection::GetList( $sort, $filter, false, $select ); while( $el = $list -> Fetch() ) : $cats[] = $el; if( intval( @$_GET[ 'cat' ] ) == $el[ 'ID' ] ) : $cat = $el; endif; endwhile; if( !isset( $cat ) ) : $cat = $cats[ 0 ]; endif; ob_start(); ?>