Section Showing Twice in Breadcrumbs

Phoca Download - download manager
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section Showing Twice in Breadcrumbs

Post by Jan »

Aha, now I understand, the problem is not a duplication of section but the problem occurs if you will name the menu link the same as section.

In such case you need to customize the code. But there is a problem because the patway includes the menu link to download.

see e.g.:
components\com_phocadownload\views\category\view.html.php

line cca 202

Code: Select all

$pathway 		=& $mainframe->getPathway();
now the patway includes the menu link.

With this code the section will be added:

Code: Select all

if (!empty($section[0]->title)) {
			$pathway->addItem($section[0]->title, JRoute::_(PhocaDownloadHelperRoute::getSectionRoute($section[0]->id, $section[0]->alias)));
		}
So you can comment it to remove the section from the breadcrumbs, but no idea if this will not cause some url problem.

And be aware - section is link to section view but the menu link can be a link to sections view.

Jan
If you find Phoca extensions useful, please support the project
sender
Phoca Member
Phoca Member
Posts: 12
Joined: 26 Jun 2010, 22:58

Re: Section Showing Twice in Breadcrumbs

Post by sender »

Solved!!!

For me solved!

I have to do the same operation in:

components\com_phocadownload\views\section\view.html.php

Thanks. Solved!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section Showing Twice in Breadcrumbs

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
pweb
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 27 Aug 2010, 19:26
Location: Poland
Contact:

Re: Section Showing Twice in Breadcrumbs

Post by pweb »

The solution is:

We shouldn't show section in breadcrumbs if menu item view is section, category or file.

/components/com_phocadownload/views/category/view.html.php

Code: Select all

// Breadcrumbs
		$menus	= &JSite::getMenu();
		$menu    = $menus->getActive();
		
		$pathway 		=& $mainframe->getPathway();
		if (!empty($section[0]->title) && $menu->query['view'] != 'section' && $menu->query['view'] != 'category' && $menu->query['view'] != 'file') {
			$pathway->addItem($section[0]->title, JRoute::_(PhocaDownloadHelperRoute::getSectionRoute($section[0]->id, $section[0]->alias)));
		}
		if (!empty($category[0]->title) && $menu->query['view'] != 'category' && $menu->query['view'] != 'file') {
			$pathway->addItem($category[0]->title);
		}
We shouldn't show category in breadcrumbs if menu item view is category or file

/components/com_phocadownload/views/section/view.html.php

Code: Select all

// Breadcrumbs
		$menus	= &JSite::getMenu();
		$menu    = $menus->getActive();
		
		if (!empty($section[0]->title) && $menu->query['view'] != 'section' && $menu->query['view'] != 'category' && $menu->query['view'] != 'file') {
			$pathway 		=& $mainframe->getPathway();
			$pathway->addItem($section[0]->title, JRoute::_(PhocaDownloadHelperRoute::getSectionsRoute()));
		}
The same you should do for file view.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section Showing Twice in Breadcrumbs

Post by Jan »

Hi, thank you for this info.

Jan
If you find Phoca extensions useful, please support the project
pweb
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 27 Aug 2010, 19:26
Location: Poland
Contact:

Re: Section Showing Twice in Breadcrumbs

Post by pweb »

I have forgotten to add check of component attached to the current menu Item.

Code: Select all

$menu->query['option'] == 'com_phocadownload'
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section Showing Twice in Breadcrumbs

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Michael 12
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 20 Mar 2012, 20:13

Re: Section Showing Twice in Breadcrumbs

Post by Michael 12 »

I have the same problem with joomla 2.5.3 and phoca download 2.1.5., but the solution here doesn`t seem to work - I only get a white page. Has there been changes in the code and has anyone a solution?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Section Showing Twice in Breadcrumbs

Post by Jan »

Hi, try to see the error message (php):
https://www.phoca.cz/documents/16-joomla ... rs-on-site

Jan
If you find Phoca extensions useful, please support the project
chrisjclay
Phoca Member
Phoca Member
Posts: 26
Joined: 06 Oct 2011, 19:56

Re: Section Showing Twice in Breadcrumbs

Post by chrisjclay »

Here's how I solved this on my Joomla 2.5.4 site:

1. I changed the Phoca Download category names to exactly match the Joomla menu item names. I also changed Phoca sub-category names to match their Joomla sub-menu item names. I had been using slight variations (for example, I made a menu item called "Key Documents" but I had called the corresponding Phoca category simply "Documents.")

2. In components/com_phocadownload/views/category/view.html.php I found this line (around line #317):

Code: Select all

if($this->category[0]->parenttitle != $curpath[count($curpath)-1]){
... and changed it to this:

Code: Select all

if(($this->category[0]->parenttitle != $curpath[count($curpath)-2])&&($this->category[0]->parenttitle != $curpath[count($curpath)-1])){
Now the breadcrumbs are displaying properly :)

Image

Cheers,
Chris
Post Reply