код нашел
Код:
public static function getPath($id_category, $path = '', $linkOntheLastItem = false, $categoryType = 'products')
{
global $link, $cookie;
if ($id_category == 1)
return '<span class="navigation_end">'.$path.'</span>';
$pipe = Configuration::get('PS_NAVIGATION_PIPE');
if (empty($pipe))
$pipe = '>';
$fullPath = '';
if ($categoryType === 'products')
{
$category = Db::getInstance()->getRow('
SELECT id_category, level_depth, nleft, nright
FROM '._DB_PREFIX_.'category
WHERE id_category = '.(int)$id_category);
if (isset($category['id_category']))
{
$categories = Db::getInstance()->ExecuteS('
SELECT c.id_category, cl.name, cl.link_rewrite
FROM '._DB_PREFIX_.'category c
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($cookie->id_lang).' AND c.id_category != 1
ORDER BY c.level_depth ASC
LIMIT '.(int)$category['level_depth']);
$n = 1;
$nCategories = (int)sizeof($categories);
foreach ($categories AS $category)
{
$fullPath .=
(($n < $nCategories OR $linkOntheLastItem) ? '<a href="'.self::safeOutput($link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'])).'" title="'.htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').'">' : '').
htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').
(($n < $nCategories OR $linkOntheLastItem) ? '</a>' : '').
(($n++ != $nCategories OR !empty($path)) ? '<span class="navigation-pipe">'.$pipe.'</span>' : '');
}
return $fullPath.$path;
}
}
elseif ($categoryType === 'CMS')
{
$category = new CMSCategory((int)($id_category), (int)($cookie->id_lang));
if (!Validate::isLoadedObject($category))
die(self::displayError());
$categoryLink = $link->getCMSCategoryLink($category);
if ($path != $category->name)
$fullPath .= '<a href="'.self::safeOutput($categoryLink).'">'.htmlentities($category->name, ENT_NOQUOTES, 'UTF-8').'</a><span class="navigation-pipe">'.$pipe.'</span>'.$path;
else
$fullPath = ($linkOntheLastItem ? '<a href="'.self::safeOutput($categoryLink).'">' : '').htmlentities($path, ENT_NOQUOTES, 'UTF-8').($linkOntheLastItem ? '</a>' : '');
return self::getPath((int)($category->id_parent), $fullPath, $linkOntheLastItem, $categoryType);
}
}
/**
* @param string [optionnal] $type_cat defined what type of categories is used (products or cms)
*/
public static function getFullPath($id_category, $end, $type_cat = 'products')
{
global $cookie;
$pipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>');
if ($type_cat === 'products')
$category = new Category((int)($id_category), (int)($cookie->id_lang));
elseif ($type_cat === 'CMS')
$category = new CMSCategory((int)($id_category), (int)($cookie->id_lang));
if (!Validate::isLoadedObject($category))
$id_category = 1;
if ($id_category == 1)
return htmlentities($end, ENT_NOQUOTES, 'UTF-8');
return self::getPath($id_category, $category->name, true, $type_cat).'<span class="navigation-pipe">'.$pipe.'</span> <span class="navigation_product">'.htmlentities($end, ENT_NOQUOTES, 'UTF-8').'</span>';
}
Но честно говоря за 5 мин он мне не по зубам, а перезаливать и откатывать файлы назад с этой разметкой уже нет сил...
Можете помочь расставить ?
Категория
Код:
<span itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">
<a itemprop="item" title="глубина 2" href="">
<span itemprop="name">глубина 2</span>
<meta itemprop="position" content="2">
</a>
</span>
СубкатегорияКод:
<span itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">
<a itemprop="item" title="глубина 3" href="">
<span itemprop="name">глубина 3</span>
<meta itemprop="position" content="3">
</a>
</span>
Продукт
Код:
<span itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">
<a itemprop="item" title="продукт" href="">
<span itemprop="name">продукт</span>
<meta itemprop="position" content="4">
</a>
</span>
Сообщение отредактировал SDM (13-01-2021 19:09)