Duplicated confusing breadcrumbs with Joomla 5 and Phoca Download v5.0.0Beta2
-
plamen
- Phoca Professional

- Posts: 114
- Joined: 16 Mar 2014, 13:23
Re: Duplicated confusing breadcrumbs with Joomla 5 and Phoca Download v5.0.0Beta2
OK, thank you. Will try.
- Jan
- Phoca Hero

- Posts: 49490
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Duplicated confusing breadcrumbs with Joomla 5 and Phoca Download v5.0.0Beta2
OK
If you find Phoca extensions useful, please support the project
-
Michael 12
- Phoca Newbie

- Posts: 2
- Joined: 20 Mar 2012, 20:13
Re: Duplicated confusing breadcrumbs with Joomla 5 and Phoca Download v5.0.0Beta2
Hello, I had a double breadcrumb problem with joomla 6.1 & phoca download 6.1. The option "Breadcrumbs deaktivate" was on yes (important!), but it was ignored. The tips in the article doesnt work for me because I want submenus (for same menu structure on the whole site). So I did some try & error with chatgpt, and could resolve it FOR ME. The changes:
First one for categorys: /com_phocadownload/views/category/view.html.php
// Breadcrumb display:
// 0 - only menu link
// 1 - menu link - category name
// 2 - only category name
$this->_addBreadCrumbs( isset($menu->query['id']) ? $menu->query['id'] : 0, 1);
parent::display($tpl);
changed to:
// Breadcrumb display:
// 0 - only menu link
// 1 - menu link - category name
// 2 - only category name
// Nur wenn die Option NICHT auf 1 (Ja) steht, darf Phoca den Pfad manipulieren
if ((int)$this->t['disable_breadcrumbs_category_view'] !== 1) {
$this->_addBreadCrumbs( isset($menu->query['id']) ? $menu->query['id'] : 0, 1);
}
parent::display($tpl);
Second one for file details: /com_phocadownload/views/file/view.html.php
The whole part at the end changed to:
function _addBreadCrumbs($rootId, $displayStyle, $file)
{
$app = Factory::getApplication();
$pathway = $app->getPathway();
// FIX: Überspringt das Verdoppeln der Kategorien, wenn die Option im Backend greift
if ((int)$this->t['p']->get('disable_breadcrumbs_category_view', 0) !== 1) {
$i = 0;
$category = $this->category[0];
while (isset($category->id))
{
$crumbList[$i++] = $category;
if ($category->id == $rootId)
{
break;
}
$db = Factory::getDBO();
$query = 'SELECT * FROM #__phocadownload_categories AS c WHERE c.id = '.(int) $category->parent_id.' AND c.published = 1';
$db->setQuery($query);
$rows = $db->loadObjectList('id');
if (!empty($rows)) {
$category = $rows[$category->parent_id];
} else {
$category = '';
}
}
$pathWayItems = $pathway->getPathWay();
$lastItemIndex = count($pathWayItems) - 1;
for ($i--; $i >= 0; $i--)
{
if ($crumbList[$i]->id == $rootId)
{
switch ($displayStyle)
{
case 0:
break;
case 1:
$pathway->setItemName($lastItemIndex, $pathWayItems[$lastItemIndex]->name . ' - ' . $crumbList[$i]->title);
break;
case 2:
$pathway->setItemName($lastItemIndex, $crumbList[$i]->title);
break;
}
}
else
{
$link = PhocaDownloadRoute::getCategoryRoute($crumbList[$i]->id, $crumbList[$i]->alias);
$pathway->addItem($crumbList[$i]->title, Route::_($link));
}
}
}
// Hängt den Dateinamen am Ende sauber an
if (isset($file->title) && $file->title != '') {
$pathway->addItem($file->title);
}
}
}
?>
I have no Idea why the option "Breadcrumbs deaktivate" doesnt worked for me. Sorry for my bad english and I hope its ok to post some code here.
First one for categorys: /com_phocadownload/views/category/view.html.php
// Breadcrumb display:
// 0 - only menu link
// 1 - menu link - category name
// 2 - only category name
$this->_addBreadCrumbs( isset($menu->query['id']) ? $menu->query['id'] : 0, 1);
parent::display($tpl);
changed to:
// Breadcrumb display:
// 0 - only menu link
// 1 - menu link - category name
// 2 - only category name
// Nur wenn die Option NICHT auf 1 (Ja) steht, darf Phoca den Pfad manipulieren
if ((int)$this->t['disable_breadcrumbs_category_view'] !== 1) {
$this->_addBreadCrumbs( isset($menu->query['id']) ? $menu->query['id'] : 0, 1);
}
parent::display($tpl);
Second one for file details: /com_phocadownload/views/file/view.html.php
The whole part at the end changed to:
function _addBreadCrumbs($rootId, $displayStyle, $file)
{
$app = Factory::getApplication();
$pathway = $app->getPathway();
// FIX: Überspringt das Verdoppeln der Kategorien, wenn die Option im Backend greift
if ((int)$this->t['p']->get('disable_breadcrumbs_category_view', 0) !== 1) {
$i = 0;
$category = $this->category[0];
while (isset($category->id))
{
$crumbList[$i++] = $category;
if ($category->id == $rootId)
{
break;
}
$db = Factory::getDBO();
$query = 'SELECT * FROM #__phocadownload_categories AS c WHERE c.id = '.(int) $category->parent_id.' AND c.published = 1';
$db->setQuery($query);
$rows = $db->loadObjectList('id');
if (!empty($rows)) {
$category = $rows[$category->parent_id];
} else {
$category = '';
}
}
$pathWayItems = $pathway->getPathWay();
$lastItemIndex = count($pathWayItems) - 1;
for ($i--; $i >= 0; $i--)
{
if ($crumbList[$i]->id == $rootId)
{
switch ($displayStyle)
{
case 0:
break;
case 1:
$pathway->setItemName($lastItemIndex, $pathWayItems[$lastItemIndex]->name . ' - ' . $crumbList[$i]->title);
break;
case 2:
$pathway->setItemName($lastItemIndex, $crumbList[$i]->title);
break;
}
}
else
{
$link = PhocaDownloadRoute::getCategoryRoute($crumbList[$i]->id, $crumbList[$i]->alias);
$pathway->addItem($crumbList[$i]->title, Route::_($link));
}
}
}
// Hängt den Dateinamen am Ende sauber an
if (isset($file->title) && $file->title != '') {
$pathway->addItem($file->title);
}
}
}
?>
I have no Idea why the option "Breadcrumbs deaktivate" doesnt worked for me. Sorry for my bad english and I hope its ok to post some code here.