VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: man.of.earth on September 04, 2019, 23:44:29 PM

Title: Bug in breadcrumb when product page is added as a menu item
Post by: man.of.earth on September 04, 2019, 23:44:29 PM
Hello,
I saw that when a product page is added as a menu item, the breadcrumb doubles a part of the path

I looked into /components/com_virtuemart/views/productdetails/view.html.php and commented out the lines 226 through 236, and the breadcrumb is displayed correctly. There was even a comment before these lines, which confirmed that bug.

//Seems we dont need this anylonger, destroyed the breadcrumb
/*if ($category->parents) {
foreach ($category->parents as $c) {
if(is_object($c) and !empty($c->category_name) and !empty($c->published)){
$pathway->addItem(strip_tags(vmText::_($c->category_name)), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
} else {
vmdebug('Error, parent category has no name, breadcrumb maybe broken, category',$c);
}
}
}
*/


Here's a screenshot of how it looks like/
Title: Re: Bug in breadcrumb when product page is added as a menu item
Post by: Milbo on September 07, 2019, 08:14:29 AM
When we just remove that, then the breadcrumbs are wrong for normal productdetail pages. But I see your point, in my example the menu item is called "Produkt" and I get "Home ->Produkt ->Wear ->Dress Shirt with tie"
when I have the produkt without menu item, I get "Home ->Wear ->Dress Shirt with tie" and without the lines above, I just get the productname as breadcrumb.

I add it now this way

if ($category->parents and !empty($menu->query['view']) and $menu->query['view']!='productdetails') {


and additionally

if(!empty($menu->query['view']) and $menu->query['view']=='productdetails' and $menu->title == $product->product_name) {
$addPrdNameCrumb = false;
}
if($addPrdNameCrumb)$pathway->addItem(strip_tags(html_entity_decode($product->product_name,ENT_QUOTES)));
Title: Re: Bug in breadcrumb when product page is added as a menu item
Post by: man.of.earth on September 07, 2019, 15:19:44 PM
I'm using menu item IDs for each VM product, so I didn't see the second case you showed. But it's good that the corrections are applied in the next VM versions.
Title: Re: Bug in breadcrumb when product page is added as a menu item
Post by: Milbo on September 09, 2019, 08:22:51 AM
Yes, so the second code prevents that you see the product name twice (one time from the menu item, one time the product name)
Title: Re: Bug in breadcrumb when product page is added as a menu item
Post by: man.of.earth on October 13, 2019, 16:23:31 PM
For some time I noticed that this fix also makes the breadcrumb show the product twice: first with the name of the menu item, and secondly with the name of the product.

Much later edit  :):
I see it works well on vmbeez3. The doubling I still saw seems to be Gantry related.