Details Issue and Breadcrumbs

Phoca Download - download manager
Ez0n3
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 13 Jan 2012, 07:05

Details Issue and Breadcrumbs

Post by Ez0n3 »

Wanted to say thanks for this module plugins. ;)

Using (offline, for now):
Joomla_1.7.3
com_phocadownload_v2.1.4
plg_content_phocadownload_v2.1.4
plg_editors-xtd_phocadownload_v2.1.4
plg_search_phocadownload_v2.0.1

I'm having a small issue with the details for the downloads. Sometimes the show up just fine, and sometimes there's no details at all.

IE: If the details are set to "bottom", the details appear below the link and are always shown. If it's set to "popup[thingy]", the details appear in a popup window after the Details button has been pressed. Either way, sometimes, the details don't appear in either place. So there will be no details below the link (bottom) and/or no details in the window that pops up.

I'm trying to search the board here for info, but I keep getting a "sorry, this board is unavailable right now" page about every 5 min for some reason. Busy forum or something. :/

On a side note:
I noticed the breadcrumbs only worked correctly up to a certain depth (3 I think). Then the first most crumb would start being overwritten by the next one up, and so on. I have a workaround, but I'm not sure if it's right (I'm pretty new to Joomla).

/components/com_phocadownload/models/category.php (around line 77)
Find:

Code: Select all

	function getCategory($categoryId) {	
		if (empty($this->_category)) {			
			$query					= $this->_getCategoriesQuery( $categoryId, FALSE );
			$this->_category 		= $this->_getList( $query, 0, 1 );
		}
		return $this->_category;
	}
Replace:

Code: Select all

	function getCategory($categoryId) {	
		//if (empty($this->_category)) { // <-- comment this line
			$query					= $this->_getCategoriesQuery( $categoryId, FALSE );
			$this->_category 		= $this->_getList( $query, 0, 1 );
		//} // <-- comment this line
		return $this->_category;
	}
By removing the "if (empty($this->_category))" check, it can be called from elsewhere - but is that ok/correct?

/components/com_phocadownload/views/category/view.html.php (around line 283)
Find:

Code: Select all

	// Breadcrumbs TODO (Add the whole tree)
	$pathway 		= $app->getPathway();
	if (isset($this->category[0]->parentid)) {
		if ($this->category[0]->parentid == 0) {
			// $pathway->addItem( JText::_('COM_PHOCADOWNLOAD_CATEGORIES'), JRoute::_(PhocaDownloadHelperRoute::getCategoriesRoute()));
		} else if ($this->category[0]->parentid > 0) {
			$curpath = $pathway->getPathwayNames();
			if($this->category[0]->parenttitle != $curpath[count($curpath)-1]){
				$pathway->addItem($this->category[0]->parenttitle, JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($this->category[0]->parentid, $this->category[0]->parentalias)));
			}
		}
	}

	if (!empty($this->category[0]->title)) {
		$curpath = $pathway->getPathwayNames();
		if($this->category[0]->title != $curpath[count($curpath)-1]){
			$pathway->addItem($this->category[0]->title);
		}
	}
Replace:

Code: Select all

	$model = &$this->getModel();
	$id = (int) $this->category[0]->id;
	
	if ($menu) {
		$path = array(array('title' => $this->category[0]->title, 'link' => ''));
		$category = $model->getCategory($this->category[0]->parentid);
		
		while (($id != $category[0]->id) && $category[0]->id > 0)
		{
			$path[] = array('title' => $category[0]->title, 'link' => JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($category[0]->id, $category[0]->alias)));
			
			$category = $model->getCategory($category[0]->parentid);
			if (!is_object($category))
				continue;
		}

		$path = array_reverse($path);

		foreach ($path as $item)
		{
			$pathway->addItem($item['title'], $item['link']);
		}
	}
Since the check on the function getCategory() has been commented out (above), I can grab the category info for any cat by passing it the id - but is this ok/correct?

Root level categories have an id of "0", so based on the other Joomla code, it should add the current page to the breadcrumb first (without link text, so that it's not clickable - since you're already there). Then while the categories have parents, move up the the path until the root is reached.

Like I said, it works, but I'm not sure it's right :idea:

Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48610
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Details Issue and Breadcrumbs

Post by Jan »

Hi, thanks for this info, I will do some tests to check it.

Jan
If you find Phoca extensions useful, please support the project
Post Reply