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/
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)));
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.
Yes, so the second code prevents that you see the product name twice (one time from the menu item, one time the product name)
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.