News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Breadcrumbs links not SEF

Started by -Tony-, June 09, 2015, 12:56:58 PM

Previous topic - Next topic

-Tony-

Hello
Joomla 3.4.1
Virtuemart 3.0.9
SEF url enabled
Since I made the migration, i notice a problem with virtuemart links on breadcrumbs i had not noticed on older versions. I am seen me when i wanted to do an override of mod_breadcrumbs to add microdatas.
(Breadcrumbs for Joomla links works perfectly)
The problem :

*For Virtuemart home page :

url SEF : www.mydomain.com/name-of-virtuemart-home-page

url of breadcrumb : www.mydomain.com/name-of-virtuemart-home-page?productsublayout=0

*For category pages :

url SEF : www.mydomain.com/name-of-virtuemart-home-page/name-of-category-page

url of breadcrumb : www.mydomain.com/name-of-virtuemart-home-page/name-of-category-page/manufacturer/?categorylayout=0&showcategory=1&showproducts=1&productsublayout=0

*For Productdetails pages :

url SEF : www.mydomain.com/name-of-virtuemart-home-page/name-of-category-page/name-of-my-product

url of breadcrumb : www.mydomain.com

I guess the source of all this is in the router.php of virtuemart or/and view.html.php of category/productdetails/virtuemart... I've looked but I did not quite good in php to accurately locate lines in question ...

I thought of a temporary solution that will be in mod_breadcrumbs not to call the url with href = "'. $ Item-> link." Virtuemart since air having problems with the interpretation of itemid, but with aliases, except for the syntax I do not see ...

Thanks

-Tony-

I tried various things but it did not work, following the example of the mod_menu.
Virtuemart url called by mod_menu are ok and not those of mod_breadcrumbs and I can't do the same...

-Tony-

Maybe I did not give enough information, sorry if.
But I thought the explanation of my first message was quite clear.
Template homemade/customized, based on Horme template I was using before.
Overrides to defuse calls of functions and combine them with libraries into a single script and deferred.
Overrides html for the layout.
Link : http://www.brundubonsai.fr/

franzpeter

Did you manually insert the virtuemart homepage link or did you link the shop (virtuemart page) in the default way: adding menu item with Joomla, name it for example shop and choose Virtuemart Standard page or so?

franzpeter

#4
Sorry, now I understand what was meant. You do a normal navigation (not the breadcrumb navigation) for example to a product and it shows www.mydomain.com/name-of-virtuemart-home-page/name-of-category-page/name-of-my-product. If you use the breadcrumb link to navigate back to www.mydomain.com/name-of-virtuemart-home-page it shows: www.mydomain.com/name-of-virtuemart-home-page?productsublayout=0.
Yes I can confirm that behaviour.

I think at the moment the quickest solution is to not show the breadcrumb navigation with name-of-virtuemart-home-page means to not show the breadcrumb module and use the VM navigation instead.

-Tony-

Hi
Thanks for your reply
i remember I do like this:
in: menu management
new
Type menu link
selected: Homepage virtuemart
and for category selected category virtuemart, and parent is homepage virtuemart.
It's the good way ?

-Tony-

#6
Ok, disable the breadcrumbs on category and product page and waiting for a fix.

So i think I'll try to keep only the name and remove the link to productdetails, category and virtuemart view.

Like this :

<ul class="breadcrumbs<?php echo $moduleclass_sfx?>">
<?php if ($params->get('showHere'1))
{
echo '<li itemprop="breadcrumb" class="active">' JText::_('MOD_BREADCRUMBS_HERE') . '</li>';
}

// Get rid of duplicated entries on trail including home page when using multilanguage
for ($i 0$i $count$i++)
{
if ($i == && !empty($list[$i]->link) && !empty($list[$i 1]->link) && $list[$i]->link == $list[$i 1]->link)
{
unset($list[$i]);
}
}

// Find last and penultimate items in breadcrumbs list
end($list);
$last_item_key key($list);
prev($list);
$penult_item_key key($list);
// Make a link if not the last item in the breadcrumbs
$show_last $params->get('showLast'1);
// Generate the trail
$view JRequest::getCmd('view');
foreach ($list as $key => $item) :
if (
$view != 'virtuemart') || ($view != 'category') || ($view != 'productdetails') {
if ($key != $last_item_key)
{
// Render all but last item - along with separator
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">';
if (!empty($item->link))
{
echo '<a itemprop="url" href="' $item->link '" class="pathway"><span itemprop="title">' $item->name '</span></a>';
}
else
{
echo '<span>' $item->name '</span>';
}

echo '</li>';
}
elseif ($show_last)
{
// Render last item if reqd.
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active">';
echo '<a itemprop="url" href="' $item->link '" class="pathway"><span itemprop="title">' $item->name '</span></a>';
echo '</li>';
}
}
if (
$view == 'virtuemart') || ($view == 'category') || ($view == 'productdetails') {
if ($key != $last_item_key)
{
// Render all but last item - along with separator
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">';
if (!empty($item->link))
{
echo '<span itemprop="title">' $item->name '</span></a>';
}
else
{
echo '<span>' $item->name '</span>';
}

echo '</li>';
}
elseif ($show_last)
{
// Render last item if reqd.
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active">';
echo '<span itemprop="title">' $item->name '</span></a>';
echo '</li>';
}
}
endforeach; ?>

</ul>


i think it will work

Studio 42

HI,
It's strange, i don't have any problems in breadcrumb, it's always clear. Perhaps it's when you set a layout in VM?
More strange you have "fournisseur" in the link. as if the view was filtered by "manufacturer" ?!?

Greets,
Patrick

P.S:Site sympa au passage, j'adore les bonsaï, mais j'ai pas la patiente  ;)

franzpeter

@Studio 42: I have those problems too if switching on the breadcrumb module. There is no problem as long as you do not use the breadcrumbs for navigation. It is more a cosmetical problem, because the canonical url is always well created, only the url makes problems. It is as soon as you navigate with the breadcrumb links.

-Tony-

Hi Patrick
Thanks for your reply

In the menu configuration, all category and home page was on no override, so after your reply i've selected "default" for default.php i imagine (my layout override for category views), but no changes, just in the path ?categorylayout=0 change to ?categorylayout=default
and for home page but for sublayouts, the choice is no overrided or product_horizon, but i've no overrided product_horizon.php, sublayouts i've overrided is askrecomjs.php and products.php...

For "manufacturer", yeah...that's also strange, i've no manufacturer because manufacturer it's me and so in virtuemart configuration manufacturer was empty (manufacturer=0).
I had a issue because of that.
For example, for canonical link in category view, added"manufacturer" in the pathway, so i've apply a fix found on this forum :


//changed this

$link = 'index.php?option=com_virtuemart&view=category';
if($categoryId!==-1){
$link .= '&virtuemart_category_id='.$categoryId;
}
if($manId!==-1){
$link .= '&virtuemart_manufacturer_id='.$manId;
}

$document->addHeadLink( JRoute::_($link, FALSE) , 'canonical', 'rel', '' );

//by this

$link = 'index.php?option=com_virtuemart&view=category';
if($categoryId!==-1){
$link .= '&virtuemart_category_id='.$categoryId;
}
if($manId!==-1 && $manId >=1){
$link .= '&virtuemart_manufacturer_id='.$manId;
}

$document->addHeadLink(JRoute::_($link, FALSE) , 'canonical', 'rel', '' );


Perhaps it's the same way for the pathway somewhere in a file?



Merci Patrick, Le bonsai c'est vraiment cool, et justement un rapport au temps un peu paradoxal avec la société actuelle ;)

-Tony-

Quote from: franzpeter on June 17, 2015, 10:18:52 AM
@Studio 42: I have those problems too if switching on the breadcrumb module. There is no problem as long as you do not use the breadcrumbs for navigation. It is more a cosmetical problem, because the canonical url is always well created, only the url makes problems. It is as soon as you navigate with the breadcrumb links.

Hi
I think when you added microdatas on breadcrumbs it's more important, url considered for rich snippet breadcrumbs must be the canonical url for good seo.


PRO

mod_breadcrumbs/tmpl/default.php

I added this
$item->link=str_replace( 'manufacturer/?categorylayout=0&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0', '', $item->link);


// Render all but last item - along with separator
      echo '<li>';
      if (!empty($item->link))
      {  $item->link=str_replace( 'manufacturer/?categorylayout=0&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0', '', $item->link);
         echo '<a href="' . $item->link . '" class="pathway">' . $item->name . '</a>';
      }

-Tony-

Yeaah ! thank you very much !

So i do this :


$item->link=str_replace( 'fournisseur/?categorylayout=default&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0', '', $item->link);
$item->link=str_replace( '?productsublayout=0', '', $item->link);


And it works
Exept the last item in productdetails view, productdetails have no pathway

So i do this :


elseif ($show_last)
{$monUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
// Render last item if reqd.
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active">';
echo '<a itemprop="url" href="' . $monUrl . '" class="pathway"><span itemprop="title">' . $item->name . '</span></a>';
echo '</li>';
}


And it works

happy end, thank you all.

vinhbui2488

Quote from: PRO on June 17, 2015, 16:49:03 PM
mod_breadcrumbs/tmpl/default.php

I added this
$item->link=str_replace( 'manufacturer/?categorylayout=0&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0', '', $item->link);


// Render all but last item - along with separator
      echo '<li>';
      if (!empty($item->link))
      {  $item->link=str_replace( 'manufacturer/?categorylayout=0&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0', '', $item->link);
         echo '<a href="' . $item->link . '" class="pathway">' . $item->name . '</a>';
      }

Why I can do it ??
My code :

<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_breadcrumbs
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip');

?>


<ul class="breadcrumb<?php echo $moduleclass_sfx?>">
<?php
if (
$params->get('showHere'1))
{
echo '<li class="active">' JText::_('MOD_BREADCRUMBS_HERE') . '&#38;#160;</li>';
}
else
{
echo '<li class="active"><span class="divider icon-location"></span></li>';
}

// Get rid of duplicated entries on trail including home page when using multilanguage
for ($i 0$i $count$i++)
{
if ($i == && !empty($list[$i]->link) && !empty($list[$i 1]->link) && $list[$i]->link == $list[$i 1]->link)
{
unset($list[$i]);
}
}

// Find last and penultimate items in breadcrumbs list
end($list);
$last_item_key key($list);
prev($list);
$penult_item_key key($list);

// Make a link if not the last item in the breadcrumbs
$show_last $params->get('showLast'1);

// Generate the trail
foreach ($list as $key => $item) :
if ($key != $last_item_key)
{
// Render all but last item - along with separator
echo '<li>';
if (!empty($item->link))
{
echo '<a href="' $item->link '" class="pathway">' $item->name '</a>';
}
else
{
echo '<span>' $item->name '</span>';
}

if (($key != $penult_item_key) || $show_last)
{
echo '<span class="divider">' $separator '</span>';
}

echo '</li>';
}
elseif ($show_last)
{
// Render last item if reqd.
echo '<li class="active">';
echo '<span>' $item->name '</span>';
echo '</li>';
}
endforeach; ?>

</ul>


My site:
eshop4vn.com