Current Path : /home/bitrix/ext_www/ballu.in.ua/bitrix/ |
Current File : /home/bitrix/ext_www/ballu.in.ua/bitrix/init.php |
<? // Optima iblock switcher function changeOptimaCatalogIblockByUrl(){ $arOptimaIblocksTable = array( "/_optima/catalog-items-table/" => array( 'CODE' => 'clothes', 'LIST_PAGE_URL' => '#SITE_DIR#/_optima/catalog-items-table/', 'SECTION_PAGE_URL' => '#SITE_DIR#/_optima/catalog-items-table/#SECTION_CODE_PATH#/', 'DETAIL_PAGE_URL' => '#SITE_DIR#/_optima/catalog-items-table/#SECTION_CODE_PATH#/#ELEMENT_CODE#/' ), "/_optima/catalog-armatura/" => array( 'CODE' => 'clothes', 'LIST_PAGE_URL' => '#SITE_DIR#/_optima/catalog-armatura/', 'SECTION_PAGE_URL' => '#SITE_DIR#/_optima/catalog-armatura/#SECTION_CODE_PATH#/', 'DETAIL_PAGE_URL' => '#SITE_DIR#/_optima/catalog-armatura/#SECTION_CODE_PATH#/#ELEMENT_CODE#/' ), "/catalog/" => array( 'CODE' => 'clothes', 'LIST_PAGE_URL' => '#SITE_DIR#/catalog/', 'SECTION_PAGE_URL' => '#SITE_DIR#/catalog/#SECTION_CODE_PATH#/', 'DETAIL_PAGE_URL' => '#SITE_DIR#/catalog/#SECTION_CODE_PATH#/#ELEMENT_CODE#/' ) ); global $APPLICATION; $curdir = $APPLICATION->GetCurDir(); foreach ($arOptimaIblocksTable as $path => $arFields) { if(strpos($curdir, $path) === 0){ CModule::IncludeModule('iblock'); $ib = new CIBlock; $ob = CIBlock::GetList(array(), array("CODE" => $arFields['CODE'])); $ar = $ob->Fetch(); if($ar && $ar['LIST_PAGE_URL'] != $arFields['LIST_PAGE_URL']){ $ib->Update($ar['ID'], $arFields); } break; } } } changeOptimaCatalogIblockByUrl();