TruApt Posted June 14, 2016 Report Share Posted June 14, 2016 В каталоге, в хлебных крошках выводятся ссылки на категории, как сделать, чтобы последняя ссылка категории не была кликабельна, а то ведет сама на себя. Очень нужна помощь. Спасибо) <!-- Хлебные крошки /--> <div xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumbs"> <span typeof="v:Breadcrumb"><a href="/" rel="v:url" property="v:title">Главная</a></span> {if $category} {foreach $category->path as $cat} /<span typeof="v:Breadcrumb"> <a href="catalog/{$cat->url}" rel="v:url" property="v:title">{$cat->name|escape}</a> </span> {/foreach} {if $keyword} / Поиск {/if} {/if} </div> <!-- Хлебные крошки #End /--> Quote Link to post Share on other sites
Solution ps-simpla Posted June 14, 2016 Solution Report Share Posted June 14, 2016 {foreach $category->path as $cat} {if $cat@last} / {$cat->name|escape} {else} / {$cat->name|escape} {/if} {/foreach} Quote Link to post Share on other sites
TruApt Posted June 14, 2016 Author Report Share Posted June 14, 2016 {foreach $category->path as $cat} {if $cat@last} /<span typeof="v:Breadcrumb"> {$cat->name|escape} </span> {else} /<span typeof="v:Breadcrumb"> <a href="catalog/{$cat->url}" rel="v:url" property="v:title">{$cat->name|escape}</a> </span> {/if} {/foreach} Спасибо большое, выручили! Quote Link to post Share on other sites
LSDance Posted June 15, 2016 Report Share Posted June 15, 2016 (edited) Доброго времени! Вот еще вариант - аля - костыль)))) через псевдо-элемент *:last-child { pointer-events: none; } Соответсвенно вместо звездочки вписываете свои селекторы. P.S Элемент останется ссылкой НО перейти по ней будет невозможно и поведение будет как у НЕссылки. Edited June 15, 2016 by LSDance Quote Link to post Share on other sites
ps-simpla Posted June 15, 2016 Report Share Posted June 15, 2016 На сколько я знаю это делается для СЕО, и ваш вариант тут не подойдет. Quote Link to post Share on other sites
Kors Posted June 15, 2016 Report Share Posted June 15, 2016 1. Предложенный метод формально поставленную задачу решает, но портит хлебные крошки для страниц типа категория-бренд...2. Прежде чем изобретать давно изобретенное, полезно было бы посмотреть поиск на "хлебные крошки"... Quote Link to post Share on other sites
byrzyi Posted February 17, 2018 Report Share Posted February 17, 2018 Отлично, работает. Но, пытаюсь к брендам применить тоже самое, пока что не выходит Quote Link to post Share on other sites
byrzyi Posted February 19, 2018 Report Share Posted February 19, 2018 Все, получилось иначе, заменил в крошках products.tpl ссылку на <span>Правда если зайти не на прямую в бренды, а в бренды каталога, то пропадает ссылка на бренд (в котором находимся) вместе с самой категорией. Как я понял из перечитки форума - так заточен движек и иначе не выйдет, верно? Quote Link to post Share on other sites
Karabaska Posted February 19, 2018 Report Share Posted February 19, 2018 Правда если зайти не на прямую в бренды, а в бренды каталога, то пропадает ссылка на бренд (в котором находимся) вместе с самой категорией. Как я понял из перечитки форума - так заточен движек и иначе не выйдет, верно?Нет, не верно. Quote Link to post Share on other sites
Consult Posted December 8, 2018 Report Share Posted December 8, 2018 Подскажите, есть такой урл ведь еще/catalog/Категория/БрендТак вот там получается и ссылка на категорию не активна и на бренд тоже. Код <div id="path" class="breadcrumbs"> <a href="/">Главная</a> {if $category} {foreach from=$category->path item=cat} {if $cat@last} <sup>/</sup><span>{$cat->name|escape}</span> {else} <sup>/</sup><a href="catalog/{$cat->url}">{$cat->name|escape}</a> {/if} {/foreach} {if $brand} <sup>/</sup><span>{$brand->name|escape}</span> {/if} {elseif $brand} <sup>/</sup><span>{$brand->name|escape}</span> {elseif $keyword} <sup>/</sup><span>Поиск</span> {/if} </div> Quote Link to post Share on other sites
chocolate_moles Posted December 8, 2018 Report Share Posted December 8, 2018 Подскажите, есть такой урл ведь еще {if $cat@last} поменять на {if $cat@last && !$brand} Quote Link to post Share on other sites
Consult Posted December 8, 2018 Report Share Posted December 8, 2018 Так все работает идеально <div id="path" class="breadcrumbs"> <a href="/">Главная</a> {if $category} {foreach $category->path as $cat} {if !$cat@last || $brand}<sup>/</sup><a href="catalog/{$cat->url}">{$cat->name|escape}</a>{/if} {/foreach} {/if} <span> {if $keyword}По запросу "{$keyword|escape}" найдено: {elseif $page}<sup>/</sup>{$page->name|escape} {else}<sup>/</sup>{$category->name|escape} {$brand->name|escape} {$keyword|escape} {/if}</span> </div> Quote Link to post Share on other sites
chocolate_moles Posted December 8, 2018 Report Share Posted December 8, 2018 (edited) Так все работает идеально Нет... а может и да Edited December 8, 2018 by chocolate_moles Quote Link to post Share on other sites
get31 Posted August 10, 2021 Report Share Posted August 10, 2021 Подскажите пожалуйста, как выводить нумерацию по возрастанию в <meta itemprop="position" content="1" /> Где в категории content="1" цифра меняется в следующем на 2, 3, 4....? Вот немного моего кода: <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <a itemprop="item" href="/"> <span itemprop="name">Главная</span> </a> <meta itemprop="position" content="1" /> </li> {if $category} {foreach $category->path as $cat} <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> {if $cat->id != $category->id || $brand} <a itemprop="item" href="./{$cat->url}">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</a> {else} <span itemprop="name">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</span> {/if} <meta itemprop="position" content="{$cat->id}" /> </li> {/foreach} {/if} Quote Link to post Share on other sites
sergeevizh Posted August 10, 2021 Report Share Posted August 10, 2021 1 час назад, get31 сказал: Подскажите пожалуйста, как выводить нумерацию по возрастанию в <meta itemprop="position" content="1" /> Где в категории content="1" цифра меняется в следующем на 2, 3, 4....? Вот немного моего кода: <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <a itemprop="item" href="/"> <span itemprop="name">Главная</span> </a> <meta itemprop="position" content="1" /> </li> {if $category} {foreach $category->path as $cat} <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> {if $cat->id != $category->id || $brand} <a itemprop="item" href="./{$cat->url}">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</a> {else} <span itemprop="name">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</span> {/if} <meta itemprop="position" content="{$cat->id}" /> </li> {/foreach} {/if} {$level = 1} <ol> <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <a itemprop="item" href="/"> <span itemprop="name">Главная</span> </a> <meta itemprop="position" content="{$level++}" /> </li> {if $category} {foreach $category->path as $cat} <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> {if $cat->id != $category->id || $brand} <a itemprop="item" href="./{$cat->url}">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</a> {else} <span itemprop="name">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</span> {/if} <meta itemprop="position" content="{$level++}" /> </li> {/foreach} {/if} </ol> Quote Link to post Share on other sites
get31 Posted August 10, 2021 Report Share Posted August 10, 2021 52 минуты назад, alexivchenko сказал: {$level = 1} <ol> <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <a itemprop="item" href="/"> <span itemprop="name">Главная</span> </a> <meta itemprop="position" content="{$level++}" /> </li> {if $category} {foreach $category->path as $cat} <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> {if $cat->id != $category->id || $brand} <a itemprop="item" href="./{$cat->url}">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</a> {else} <span itemprop="name">{if $cat->breadcrumb_name}{$cat->breadcrumb_name|escape}{else}{$cat->name|escape}{/if}</span> {/if} <meta itemprop="position" content="{$level++}" /> </li> {/foreach} {/if} </ol> Спасибо! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.