Author Topic: Breadcrumbs links not SEF  (Read 25409 times)

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4656
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Breadcrumbs links not SEF
« Reply #15 on: July 29, 2015, 21:05:19 pm »
for vinhbui2488
after :
Code: [Select]
if ($key != $last_item_key)
{

vinhbui2488

  • Beginner
  • *
  • Posts: 6
  • Skype Name: vinhbui2488
Re: Breadcrumbs links not SEF
« Reply #16 on: July 30, 2015, 11:37:05 am »
for vinhbui2488
after :
Code: [Select]
if ($key != $last_item_key)
{

i change but not ok.
what can i do ??
Quote
if ($key != $last_item_key)
   {
$item->link=str_replace( 'fournisseur/?categorylayout=default&showcategory=1&showproducts=1&productsublayout=0', '', $item->link);
      // 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>';
   }

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10437
  • VirtueMart Version: 3+
Re: Breadcrumbs links not SEF
« Reply #17 on: July 30, 2015, 12:06:25 pm »
what?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4656
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Breadcrumbs links not SEF
« Reply #18 on: July 30, 2015, 20:11:39 pm »
i think this part is bad :  'fournisseur/?categorylayout=default&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0'.
Change it that is suit in your site.

vinhbui2488

  • Beginner
  • *
  • Posts: 6
  • Skype Name: vinhbui2488
Re: Breadcrumbs links not SEF
« Reply #19 on: August 30, 2015, 18:46:26 pm »
i think this part is bad :  'fournisseur/?categorylayout=default&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0'.
Change it that is suit in your site.

Thank you so much.
But i can't fix.
Code: [Select]
if ($key != $last_item_key)
{
$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>';
      }

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10437
  • VirtueMart Version: 3+
Re: Breadcrumbs links not SEF
« Reply #20 on: August 30, 2015, 22:11:02 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 :
Code: [Select]
<?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') . '&#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



<?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') . '&#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 == 1 && !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))
      {
      $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>';
      }
      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>


Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4656
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Breadcrumbs links not SEF
« Reply #21 on: August 31, 2015, 16:15:06 pm »
This part sould be removed by the virtuemart router :
Code: [Select]
?categorylayout=default&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0'. this was intruduced in VM3, but rrouter don't check for this because noone have changed the code to remove it when you have default values. Tho code as add with get method and all url query is added in the URL(this is needed when you want to add parameters eg. for search).
I already give some type to dev team to solve some error, but no answer or change from team. I update some missing code for my customer, but this is not a long term solution. Hope a day a dev give some time to update the router code.

vinhbui2488

  • Beginner
  • *
  • Posts: 6
  • Skype Name: vinhbui2488
Re: Breadcrumbs links not SEF
« Reply #22 on: August 31, 2015, 16:38:00 pm »
@Studio 42 & PRO
Thank you so much  :D

darken-ua

  • Beginner
  • *
  • Posts: 5
Re: Breadcrumbs links not SEF
« Reply #23 on: September 01, 2015, 17:55:35 pm »
I change the code in joomla breadcrumbs module nothing happens. Only when I created a category breadcrumbs in ../templates/my_template/html/ the template URL has changed, but without the .html suffix. How to add a .html suffix to the end of URL addresses?

When the problem with the navigator in the router of Virtuemart? This problem is not the first month!

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4656
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Breadcrumbs links not SEF
« Reply #24 on: September 01, 2015, 21:38:16 pm »
YOu don't need .html suffix, all browser, serach engines do not check anymore for html at end.
And you have another advantage, a link is always valid on removing last path part.
eg. home.com/category/product-details >home.com/category > home.com

Sheepiss

  • Beginner
  • *
  • Posts: 7
  • A beginner
Re: Breadcrumbs links not SEF
« Reply #25 on: January 30, 2016, 20:00:58 pm »
Hello,

what and where should I add please, when the code seems like this:
Code: [Select]
<?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 itemscope itemtype="http://schema.org/BreadcrumbList" class="breadcrumb<?php echo $moduleclass_sfx?>">
<?php if ($params->get('showHere'1)) : ?>
<li class="active">
<?php echo JText::_('MOD_BREADCRUMBS_HERE'); ?>&#160;
</li>
<?php else : ?>
<li class="active">
<span class="divider icon-location"></span>
</li>
<?php endif; ?>

<?php
// 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 ?>

<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<?php if (!empty($item->link)) : ?>
<a itemprop="item" href="<?php echo $item->link?>" class="pathway">
<span itemprop="name">
<?php echo $item->name?>
</span>
</a>
<?php else : ?>
<span itemprop="name">
<?php $item->name?>
</span>
<?php endif; ?>

<?php if (($key != $penult_item_key) || $show_last) : ?>
<span class="divider">
<?php echo $separator?>
</span>
<?php endif; ?>
<meta itemprop="position" content="<?php echo $key 1?>">
</li>
<?php elseif ($show_last) :
// Render last item if reqd. ?>

<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" class="active">
<span itemprop="name">
<?php echo $item->name?>
</span>
<meta itemprop="position" content="<?php echo $key 1?>">
</li>
<?php endif;
endforeach; ?>

</ul>

razor7

  • Jr. Member
  • **
  • Posts: 365
    • MGSCreativa - Professional VM!
Re: Breadcrumbs links not SEF
« Reply #26 on: June 03, 2016, 15:43:17 pm »
Yeaah ! thank you very much !

So i do this :

Code: [Select]
$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 :

Code: [Select]
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.

Great This works just fine!!!

Leaving my code in case anyone needs it. It's an override of breadcrumbs template inside my template html folder. In my case, I dont need the link in the last breadcrumb item...
Code: [Select]
<?php
// no direct access
defined('_JEXEC') or die;
?>


<?php
echo 
'<ul class="breadcrumbs">';
    for (
$i 0$i $count$i ++) {
$list[$i]->link str_replace'manufacturer/?categorylayout=0&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0'''$list[$i]->link);
$list[$i]->link str_replace'?productsublayout=0'''$list[$i]->link);

// If not the last item in the breadcrumbs add the separator
if ($i $count -1) {
if (!empty($list[$i]->link)) echo '<li><a href="'.$list[$i]->link.'" >'.$list[$i]->name.'</a></li>';
else echo '<li class="pathway">' $list[$i]->name '</li>';
if($i $count -2) echo ' <li class="separator">/</li> ';
} else if ($params->get('showLast'1)) { // when $i == $count -1 and 'showLast' is true
if($i 0) echo ' <li class="separator">/</li> ';
echo '<li>' $list[$i]->name '</li>';
}
}
    echo 
'</ul>';
?>

MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

vlasterx

  • Beginner
  • *
  • Posts: 3
  • Web designer and frontend developer
    • Webdizajn.org
Re: Breadcrumbs links not SEF
« Reply #27 on: July 31, 2016, 19:54:36 pm »
Code above didn't work for me, so I have used regular expression replacement in PHP and made it work.

Instead of
Code: [Select]
$list[$i]->link = str_replace( 'manufacturer/?categorylayout=0&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0', '', $list[$i]->link);
use this one
Code: [Select]
$list[$i]->link = preg_replace('/\/manufacturer\/?(.*)/', '', $list[$i]->link);
Personal portfolio web-site
http://www.webdizajn.org

My own frontend framework
https://github.com/Vlasterx/nexus-framework

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10325
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Breadcrumbs links not SEF
« Reply #28 on: August 07, 2016, 14:28:05 pm »
I already give some type to dev team to solve some error, but no answer or change from team.

as far as I know, you just gave the general advice, that it must be removed. If someone provides a patch, we take it. But so long we had no time yet.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10325
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Breadcrumbs links not SEF
« Reply #29 on: August 07, 2016, 14:31:15 pm »
ah yes and a little hint, none of the ideas here are solutions for the core. They are all quickndirty and work only for the selected variables. Actually for me it is a router issue, because it is correctly routed in the menues. So the question is, where are the 5 lines we need to add.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/