News:

Support the VirtueMart project and become a member

Main Menu

double breadcrumbs

Started by dontflinch, March 08, 2012, 19:02:25 PM

Previous topic - Next topic

dontflinch

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:

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

#1
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:


/* $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

You are my hero!!!!!!!

Btw  BreadCrumbs Advanced Module is free!

Dzifa

ridors


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

Still duplicate Categories in Breadcrumb.


dontflinch

#4
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.

Quote from: ridors on October 11, 2012, 10:53:10 AMTested in VM 2.08 with commercial and uncommercial version of Breadcrumbs advanced.

Still duplicate Categories in Breadcrumb.

ridors

QuoteIf 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

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

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

Quote from: dontflinch 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:


/* $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

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

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?