@Web1983

Как задать title для ссылок товара каталоге Bitrix?

Как задать тайтл для ссылок товара в каталоге? Сейчас там span. Спасибо.
5e835f4d484ec450150004.png
  • Вопрос задан
  • 74 просмотра
Решения вопроса 1
@Web1983 Автор вопроса
5e8386d570d06544811422.png
вот где надо добавить title к урлу:
<div class="item-title" style="height: 40px;">
                  <a href="/catalog/tv/televizor/televizor-349/?oid=12893" class="dark_link"><span>Телевизор-349"</span></a>
                </div>


вот сам код 2 части, вторая в коменте:
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
$this->setFrameMode(true);

use Bitrix\Main\Loader,
  Bitrix\Main\ModuleManager;

Loader::includeModule("iblock");

global $arTheme, $NextSectionID, $arRegion;
$arPageParams = $arSectionFilter = $arSection = $section = array();

// get current section ID
if($arResult["VARIABLES"]["SECTION_ID"] > 0){
  $arSectionFilter = array('GLOBAL_ACTIVE' => 'Y', "ID" => $arResult["VARIABLES"]["SECTION_ID"], "IBLOCK_ID" => $arParams["IBLOCK_ID"]);
}
elseif(strlen(trim($arResult["VARIABLES"]["SECTION_CODE"])) > 0){
  $arSectionFilter = array('GLOBAL_ACTIVE' => 'Y', "=CODE" => $arResult["VARIABLES"]["SECTION_CODE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"]);
}
if($arSectionFilter){
  $section = CNextCache::CIBlockSection_GetList(array('CACHE' => array("MULTI" =>"N", "TAG" => CNextCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), CNext::makeSectionFilterInRegion($arSectionFilter), false, array("ID", "IBLOCK_ID", "NAME", "DESCRIPTION", "UF_SECTION_DESCR", "UF_OFFERS_TYPE", 'UF_FILTER_VIEW', $arParams["SECTION_DISPLAY_PROPERTY"], "IBLOCK_SECTION_ID", "DEPTH_LEVEL", "LEFT_MARGIN", "RIGHT_MARGIN"));
}

$typeSKU = '';

if($section){
  $arSection["ID"] = $section["ID"];
  $arSection["NAME"] = $section["NAME"];
  $arSection["IBLOCK_SECTION_ID"] = $section["IBLOCK_SECTION_ID"];
  if($section[$arParams["SECTION_DISPLAY_PROPERTY"]]){
    $arDisplayRes = CUserFieldEnum::GetList(array(), array("ID" => $section[$arParams["SECTION_DISPLAY_PROPERTY"]]));
    if($arDisplay = $arDisplayRes->GetNext()){
      $arSection["DISPLAY"] = $arDisplay["XML_ID"];
    }
  }
  if(strlen($section["DESCRIPTION"]))
    $arSection["DESCRIPTION"] = $section["DESCRIPTION"];
  if(strlen($section["UF_SECTION_DESCR"]))
    $arSection["UF_SECTION_DESCR"] = $section["UF_SECTION_DESCR"];
  $posSectionDescr = COption::GetOptionString("aspro.next", "SHOW_SECTION_DESCRIPTION", "BOTTOM", SITE_ID);

  global $arSubSectionFilter;
  $arSubSectionFilter = array(
    "SECTION_ID" => $arSection["ID"],
    "IBLOCK_ID" => $arParams['IBLOCK_ID'],
    "ACTIVE" => "Y",
    "GLOBAL_ACTIVE" => "Y",
  );
  $iSectionsCount = CNextCache::CIBlockSection_GetCount(array('CACHE' => array("TAG" => CNextCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), CNext::makeSectionFilterInRegion($arSubSectionFilter));

  $catalog_available = $arParams['HIDE_NOT_AVAILABLE'];
  if (!isset($arParams['HIDE_NOT_AVAILABLE']))
    $catalog_available = 'N';
  if ($arParams['HIDE_NOT_AVAILABLE'] != 'Y' && $arParams['HIDE_NOT_AVAILABLE'] != 'L')
    $catalog_available = 'N';
  if($arParams['HIDE_NOT_AVAILABLE'] == 'Y')
    $catalog_available = 'Y';
  $arElementFilter = array("SECTION_ID" => $arSection["ID"], "ACTIVE" => "Y", "INCLUDE_SUBSECTIONS" => $arParams["INCLUDE_SUBSECTIONS"], "IBLOCK_ID" => $arParams["IBLOCK_ID"]);
  if($arParams["INCLUDE_SUBSECTIONS"] == "A")
  {
    $arElementFilter["INCLUDE_SUBSECTIONS"] = "Y";
    $arElementFilter["SECTION_GLOBAL_ACTIVE"] = "Y";
    $arElementFilter["SECTION_ACTIVE "] = "Y";
  }
  if($arParams['HIDE_NOT_AVAILABLE'] == 'Y')
    $arElementFilter["CATALOG_AVAILABLE"] = $catalog_available;

  $itemsCnt = CNextCache::CIBlockElement_GetList(array("CACHE" => array("TAG" => CNextCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), CNext::makeElementFilterInRegion($arElementFilter), array());

  // set offer type & smartfilter view
  $typeTmpSKU = $viewTmpFilter = 0;
  if($section['UF_OFFERS_TYPE']){
    $typeTmpSKU = $section['UF_OFFERS_TYPE'];
  }
  if($section['UF_FILTER_VIEW']){
    $viewTmpFilter = $section['UF_FILTER_VIEW'];
  }
  if(!$typeTmpSKU || !$viewTmpFilter){
    if($section['DEPTH_LEVEL'] > 1){
      $sectionParent = CNextCache::CIBlockSection_GetList(array('CACHE' => array("MULTI" =>"N", "TAG" => CNextCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), array('GLOBAL_ACTIVE' => 'Y', "ID" => $section["IBLOCK_SECTION_ID"], "IBLOCK_ID" => $arParams["IBLOCK_ID"]), false, array("ID", "IBLOCK_ID", "NAME", "UF_OFFERS_TYPE", 'UF_FILTER_VIEW'));
      if($sectionParent['UF_OFFERS_TYPE'] && !$typeTmpSKU){
        $typeTmpSKU = $sectionParent['UF_OFFERS_TYPE'];
      }
      if($sectionParent['UF_FILTER_VIEW'] && !$viewTmpFilter){
        $viewTmpFilter = $sectionParent['UF_FILTER_VIEW'];
      }

      if($section['DEPTH_LEVEL'] > 2){
        if(!$typeTmpSKU || !$viewTmpFilter){
          $sectionRoot = CNextCache::CIBlockSection_GetList(array('CACHE' => array("MULTI" =>"N", "TAG" => CNextCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), array('GLOBAL_ACTIVE' => 'Y', "<=LEFT_BORDER" => $section["LEFT_MARGIN"], ">=RIGHT_BORDER" => $section["RIGHT_MARGIN"], "DEPTH_LEVEL" => 1, "IBLOCK_ID" => $arParams["IBLOCK_ID"]), false, array("ID", "IBLOCK_ID", "NAME", "UF_OFFERS_TYPE", 'UF_FILTER_VIEW'));
          if($sectionRoot['UF_OFFERS_TYPE'] && !$typeTmpSKU){
            $typeTmpSKU = $sectionRoot['UF_OFFERS_TYPE'];
          }
          if($sectionRoot['UF_FILTER_VIEW'] && !$viewTmpFilter){
            $viewTmpFilter = $sectionRoot['UF_FILTER_VIEW'];
          }
        }
      }
    }
  }
  if($typeTmpSKU){
    $rsTypes = CUserFieldEnum::GetList(array(), array("ID" => $typeTmpSKU));
    if($arType = $rsTypes->Fetch()){
      $typeSKU = $arType['XML_ID'];
      $arTheme['TYPE_SKU']['VALUE'] = $typeSKU;
    }
  }
  if($viewTmpFilter){
    $rsViews = CUserFieldEnum::GetList(array(), array('ID' => $viewTmpFilter));
    if($arView = $rsViews->Fetch()){
      $viewFilter = $arView['XML_ID'];
      $arTheme['FILTER_VIEW']['VALUE'] = strtoupper($viewFilter);
    }
  }
}
else{
  \Bitrix\Iblock\Component\Tools::process404(
    ""
    ,($arParams["SET_STATUS_404"] === "Y")
    ,($arParams["SET_STATUS_404"] === "Y")
    ,($arParams["SHOW_404"] === "Y")
    ,$arParams["FILE_404"]
  );
}

if($arRegion)
{
  if($arRegion['LIST_PRICES'])
  {
    if(reset($arRegion['LIST_PRICES']) != 'component')
      $arParams['PRICE_CODE'] = array_keys($arRegion['LIST_PRICES']);
  }
  if($arRegion['LIST_STORES'])
  {
    if(reset($arRegion['LIST_STORES']) != 'component')
      $arParams['STORES'] = $arRegion['LIST_STORES'];
  }
}

if($arParams['LIST_PRICES'])
{
  foreach($arParams['LIST_PRICES'] as $key => $price)
  {
    if(!$price)
      unset($arParams['LIST_PRICES'][$key]);
  }
}

if($arParams['STORES'])
{
  foreach($arParams['STORES'] as $key => $store)
  {
    if(!$store)
      unset($arParams['STORES'][$key]);
  }
}

$NextSectionID = $arSection["ID"];?>

<?
//seo
$catalogInfoIblockId = CNextCache::$arIBlocks[SITE_ID]["aspro_next_catalog"]["aspro_next_catalog_info"][0];
if($catalogInfoIblockId){
  $arSeoItems = CNextCache::CIBLockElement_GetList(array('SORT' => 'ASC', 'CACHE' => array("MULTI" => "Y", "TAG" => CNextCache::GetIBlockCacheTag($catalogInfoIblockId))), array("IBLOCK_ID" => $catalogInfoIblockId, "ACTIVE" => "Y"), false, false, array("ID", "IBLOCK_ID", "PROPERTY_FILTER_URL", "PROPERTY_LINK_REGION"));
Ответ написан
Пригласить эксперта
Ответы на вопрос 2
@anton99zel
29а класс средней школы №7
Ну, наверное в шаблоне компонента? Логично же! Там же и ответ - в какой переменной содержится название для title.
<a href="...../tv/3740/" title="Телевизор"><span>Телевизор</span></a>
Ответ написан
@topuserman
Находим шаблон компонента: catalog.item или catalog.section

в папке /bitrix/templates/aspro или /local/templates/aspro

Проще всего, через административный раздел, через поиск в файловой структуре, найти по какому-то ключевому слову.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы