Author Topic: double breadcrumbs  (Read 4557 times)

dontflinch

  • Jr. Member
  • **
  • Posts: 152
double breadcrumbs
« on: March 08, 2012, 19:02:25 pm »
I have seen numerous posts about a virtuemart double breadcrumbs issue in 1.1, there is even a plugin in jed for fixing the duplication.

I am having this same problem on my vm 2.0.2 install (and since 2.0 even).  the problem is the category is appended to the proper path (for example: Catalog > Category > Product > Category)  I tried the breadcrumbs manager and have not gotten that to work yet.

I also tried the old "remove double breadcrumbs" plugin and it breaks in my new install. 

the code however is very short and I wonder if anyone here might know what to change to make it compatible?

I will paste the pretty short code from the plugin below:

Code: [Select]
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );

class plgSystemRemovedoublebreadcrumbs extends JPlugin{

function plgSystemRemovedoublebreadcrumbs( &$subject, $config ){
parent::__construct( $subject, $config );
}

function onAfterDispatch(){

$app =& JFactory::getApplication();
if ( $app->getClientId() === 0 ) {

global $mainframe;
$pathway =& $mainframe->getPathway();
$items = $pathway->getPathWay();

$aUniqueItems = array();
foreach($items as $key=>$value){
if(in_array($value->name,$aUniqueItems)){
unset($items[$key]);
}else{
$aUniqueItems[] = $value->name;
}
}

$pathway->setPathWay($items);
}
}
}
?>

dontflinch

  • Jr. Member
  • **
  • Posts: 152
Re: double breadcrumbs
« Reply #1 on: March 28, 2012, 21:16:42 pm »
I am surprised to receive no replies - not even from anyone else having this problem.  I have tried several commercial breadcrumbs extensions in an attempt to fix this and I cannot get rid of the second category crumb no matter what I do!  can anyone help adjust the previous code shown in my first post to work?


edit:   so I fixed it.  I bought the breadcrumbs advanced manager module and then edited its helper.php with this part of the code above:

Code: [Select]
/* $count = count($items);
for ($i = 0; $i < $count; $i ++)
{
$items[$i]->name = stripslashes(htmlspecialchars($items[$i]->name, ENT_COMPAT, 'UTF-8'));
$items[$i]->link = JRoute::_($items[$i]->link);
}

if ($params->get('showHome', 1))
{
$item = new stdClass();
$item->name = htmlspecialchars($params->get('homeText', JText::_('Home')));
$item->link = JRoute::_('index.php?Itemid='.$app->getMenu()->getDefault()->id);
array_unshift($items, $item);

*/


/* edited this and above to get rid of duplicate vm category issue */


$aUniqueItems = array();
foreach($items as $key=>$value){
if(in_array($value->name,$aUniqueItems)){
unset($items[$key]);
}else{
$aUniqueItems[] = $value->name;
}
}

$pathway->setPathWay($items);


/* end edit */
and voila.  of course I don't use "Home" so that would have to be adjusted if one did want to, but it did get rid of the duplication!

Dzifa

  • Beginner
  • *
  • Posts: 10
Re: double breadcrumbs
« Reply #2 on: September 30, 2012, 17:39:16 pm »
You are my hero!!!!!!!

Btw  BreadCrumbs Advanced Module is free!

Dzifa

ridors

  • Beginner
  • *
  • Posts: 12
Re: double breadcrumbs
« Reply #3 on: October 11, 2012, 10:53:10 am »

Tested in VM 2.08 with commercial and uncommercial version of Breadcrumbs advanced.

Still duplicate Categories in Breadcrumb.

 

dontflinch

  • Jr. Member
  • **
  • Posts: 152
Re: double breadcrumbs
« Reply #4 on: October 12, 2012, 00:06:27 am »
If you are using SEF you must be sure that your itemid is correct for the menu item or it will always be messed up.  Also, note the one section is commented out before the added bit.

Tested in VM 2.08 with commercial and uncommercial version of Breadcrumbs advanced.

Still duplicate Categories in Breadcrumb.

ridors

  • Beginner
  • *
  • Posts: 12
Re: double breadcrumbs
« Reply #5 on: October 12, 2012, 15:54:40 pm »
Quote
If you are using SEF you must be sure that your itemid is correct for the menu item or it will always be messed up.  Also, note the one section is commented out before the added bit.

I paste the code exactly in the helper.php as you wrote - the $count and 'showHome' Stuff is commented and I adde the  '$aUniqueItems = array();' too.

When turning of SEF Function in Joomla Breadcrumbs are fine.

I'm not sure what do you mean with the right ItemId:

When I add index.php?ItemId=53 (53 = Id I found in clear URLS or in Backend/Menu..) to my adress nothing changes.



hartey11

  • Beginner
  • *
  • Posts: 3
Re: double breadcrumbs
« Reply #6 on: October 29, 2012, 15:56:34 pm »
Hi,

I'm also having this issue but don't quite understand what changes you have made to the file, could you please paste the whole file that needs to be modified?

hartey11

  • Beginner
  • *
  • Posts: 3
Re: double breadcrumbs
« Reply #7 on: October 31, 2012, 10:51:39 am »
Hi again,

managed to figure it out thanks! the only thing i have noticed is that some of my products don't appear as links because that is the current page (which is what i want) but there are some which are still appearing as links?

Does anyone know a reason for why this might be happening?

Thanks

Regards

geolino

  • Beginner
  • *
  • Posts: 15
Re: double breadcrumbs
« Reply #8 on: November 12, 2013, 10:25:59 am »
I am surprised to receive no replies - not even from anyone else having this problem.  I have tried several commercial breadcrumbs extensions in an attempt to fix this and I cannot get rid of the second category crumb no matter what I do!  can anyone help adjust the previous code shown in my first post to work?


edit:   so I fixed it.  I bought the breadcrumbs advanced manager module and then edited its helper.php with this part of the code above:

Code: [Select]
/* $count = count($items);
for ($i = 0; $i < $count; $i ++)
{
$items[$i]->name = stripslashes(htmlspecialchars($items[$i]->name, ENT_COMPAT, 'UTF-8'));
$items[$i]->link = JRoute::_($items[$i]->link);
}

if ($params->get('showHome', 1))
{
$item = new stdClass();
$item->name = htmlspecialchars($params->get('homeText', JText::_('Home')));
$item->link = JRoute::_('index.php?Itemid='.$app->getMenu()->getDefault()->id);
array_unshift($items, $item);

*/


/* edited this and above to get rid of duplicate vm category issue */


$aUniqueItems = array();
foreach($items as $key=>$value){
if(in_array($value->name,$aUniqueItems)){
unset($items[$key]);
}else{
$aUniqueItems[] = $value->name;
}
}

$pathway->setPathWay($items);


/* end edit */
and voila.  of course I don't use "Home" so that would have to be adjusted if one did want to, but it did get rid of the duplication!

Hi, you are a genius! I have searched a long, long time  for a solution according to the double breadcrumbs. You were the only one with the right solution. Thank you from Germany!

geolino

adn424

  • Beginner
  • *
  • Posts: 4
Re: double breadcrumbs
« Reply #9 on: March 28, 2014, 07:50:42 am »
Hello Everyone,

I am sorry to tell you there is no need to go anywhere for buying new extension if you are facing what i was, infact in my case the issue occur when assigning the product to multiple categories and i had created Menu Items for main Categories, so i found a solution here:

http://forum.joomla.org/viewtopic.php?f=620&t=730195&p=3157428

infact it was to comment few lines in:
In the file components/com_virtuemart/productdetails/view.html.php

/* if ($category->parents) {

      foreach ($category->parents as $c) {

          $pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id));

      }

       }*/

This works perfect for me.

dontflinch

  • Jr. Member
  • **
  • Posts: 152
Re: double breadcrumbs
« Reply #10 on: March 28, 2014, 16:25:46 pm »
this thread is two years old and you don't even mention what version you are editing which is probably different from two years ago.  why not start your own new topic instead of trolling this one?