News:

Support the VirtueMart project and become a member

Main Menu

Breadcrumbs links not SEF

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

Previous topic - Next topic

Studio 42

for vinhbui2488
after :
if ($key != $last_item_key)
{

vinhbui2488

Quote from: Studio 42 on July 29, 2015, 21:05:19 PM
for vinhbui2488
after :
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


Studio 42

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

Quote from: Studio 42 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.

Thank you so much.
But i can't fix.

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

Quote from: vinhbui2488 on July 29, 2015, 17:08:24 PM
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') . '&#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

This part sould be removed by the virtuemart router :
?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

@Studio 42 & PRO
Thank you so much  :D

darken-ua

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

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

Hello,

what and where should I add please, when the code seems like this:
<?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

Quote from: -Tony- on June 17, 2015, 17:38:51 PM
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.

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...
<?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

Code above didn't work for me, so I have used regular expression replacement in PHP and made it work.

Instead of
$list[$i]->link = str_replace( 'manufacturer/?categorylayout=0&amp;showcategory=1&amp;showproducts=1&amp;productsublayout=0', '', $list[$i]->link);

use this one
$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

Quote from: Studio 42 on August 31, 2015, 16:15:06 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

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/