Author Topic: Bug: Duplicated breadcrumbs  (Read 30462 times)

doorknob

  • Jr. Member
  • **
  • Posts: 151
Bug: Duplicated breadcrumbs
« on: June 07, 2009, 04:13:52 am »
VM adds text to the standard Joomla breadcrumbs to create a bespoke vm breadcrumb set. This works fine when the vm module is used to simulate a menu because vm starts with the breadcrumbs for its own 'home' page and then adds the product category and product name strings to create the final breadcrumbs. This breaks down if 'VirtueMart' menu items are used. In this situation, VM uses the actual id of the menu item as the start point for the breadcrumbs and then adds more strings that duplicate the values created by Joomla. I have fixed this by changing mainframe.class (line 391 in build 1760) from:
Code: [Select]
global $mainframe;
to:
Code: [Select]
global $mainframe, $sess;

// Only add the extra pathway if the menu item is using the default VM Itemid
$Itemid = $_REQUEST['Itemid'];
if( $Itemid && $Itemid != $sess->getShopItemid() ) {
return;
}

Regards
Phil

chrism

  • Jr. Member
  • **
  • Posts: 56
Re: Bug: Duplicated breadcrumbs
« Reply #1 on: June 15, 2009, 14:15:16 pm »
Phil,

Thank you, i have implement the change above and it has fixed my duplicate breadcrumbs issue.

My change was on line 355 as i say it works so it must be the same...

\administrator\components\com_virtuemart\classes\mainframe.class line 355 directly under
function vmAppendPathway( $pathway ).

Thanks again, very good work (which should go into the next release)
Chris
Chris
www.getupandgrow.com online store and more....

chrism

  • Jr. Member
  • **
  • Posts: 56
Re: Bug: Duplicated breadcrumbs
« Reply #2 on: June 15, 2009, 14:43:16 pm »
Phil,

I notice now that when in an items flypage, the item itself is no longer in the breadcrumb and the category which is now the last breadcrumb has no link. I would like it the item still to be present and a link back to the category, is this possible? I am still very appreciative of the fix ;-)

Thanks
Chris
Chris
www.getupandgrow.com online store and more....

doorknob

  • Jr. Member
  • **
  • Posts: 151
Re: Bug: Duplicated breadcrumbs
« Reply #3 on: June 15, 2009, 18:45:24 pm »
Chris,
The principle behind my mods to breadcrumbs is:
1 Use the Joomla default approach when the page corresponds to a menu item (i.e. the item has its own menu item and the url does not include 'Itemid=xx' where xx is the item id of the VM 'home' page)
2 Use the VM function to generate the breadcrumbs when the page is not mapped directly to a menu item. Usually, product detail pages don't have menu items (not on my site).

If the product detail pages have breadcrumbs that don't include the product name then the page is considered to have its own Itemid and the Joomla breadcrumbs are being displayed instead of the VM breadcrumbs. To get the vm breadcrumbs, the page must be recognised as not having its own menu item. Take a look at this post http://forum.virtuemart.net/index.php?topic=56531.0.
Regards
Phil

chrism

  • Jr. Member
  • **
  • Posts: 56
Re: Bug: Duplicated breadcrumbs
« Reply #4 on: June 15, 2009, 22:38:34 pm »
Phil,

Thanks again your previous post explains why i am seeing what i'm seeing, i have previously implemented http://forum.virtuemart.net/index.php?topic=42931.msg162939#msg162939
which enabled me to keep focus on my VM menu items even when displaying a details page, i did this so that i could control the modules that are displayed in individual categories/flypages. Keep up the good work, i appreciate, and i'm sure many others will appreciate your work.

Thanks
Chris
Chris
www.getupandgrow.com online store and more....

vmfan

  • Beginner
  • *
  • Posts: 1
Re: Bug: Duplicated breadcrumbs
« Reply #5 on: August 02, 2009, 10:08:22 am »
VM adds text to the standard Joomla breadcrumbs to create a bespoke vm breadcrumb set. This works fine when the vm module is used to simulate a menu because vm starts with the breadcrumbs for its own 'home' page and then adds the product category and product name strings to create the final breadcrumbs. This breaks down if 'VirtueMart' menu items are used. In this situation, VM uses the actual id of the menu item as the start point for the breadcrumbs and then adds more strings that duplicate the values created by Joomla. I have fixed this by changing mainframe.class (line 391 in build 1760) from:
Code: [Select]
global $mainframe;
to:
Code: [Select]
global $mainframe, $sess;

// Only add the extra pathway if the menu item is using the default VM Itemid
$Itemid = $_REQUEST['Itemid'];
if( $Itemid && $Itemid != $sess->getShopItemid() ) {
return;
}

Regards
Phil

Thanks, thanks, thanks, thanks, 

THOUSAND THANKS

I searched so long to a solution....


Exuse my English...it´s not so good ....

Regards
Brigitte

dylanjh

  • Jr. Member
  • **
  • Posts: 85
    • Lunarhotel.co.uk
Re: Bug: Duplicated breadcrumbs
« Reply #6 on: September 18, 2009, 16:33:42 pm »
Hmmmmmmph! When I make the change it tells me "PHP Fatal error:  Call to a member function getShopItemid() on a non-object in /var/www/html/sigma/administrator/components/com_virtuemart/classes/mainframe.class.php on line 358"

Any ideas people?
Register in Joomla / Virtuemart without a Username (uses email address instead). http://www.lunarhotel.co.uk

doorknob

  • Jr. Member
  • **
  • Posts: 151
Re: Bug: Duplicated breadcrumbs
« Reply #7 on: September 22, 2009, 01:49:17 am »
Looks like you didn't declare $sess as a global or mistyped the variable name.

getShopItemid is a method of the $sess object. This object is created by VM as part of the standard VM environment and declared as a global variable. $sess therefore already exists but to use it you must make sure that it has been declared as a global in the function where it is to be used.

Good luck
Phil

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Bug: Duplicated breadcrumbs
« Reply #8 on: December 29, 2009, 07:41:08 am »
Quote
// Only add the extra pathway if the menu item is using the default VM Itemid
      $Itemid = $_REQUEST['Itemid'];
      if( $Itemid && $Itemid != $sess->getShopItemid() ) {
         return;
      }

Yes, right above this add:
global $sess;

So the final should be:

// Only add the extra pathway if the menu item is using the default VM Itemid
      $global $sess;
      $Itemid = $_REQUEST['Itemid'];
      if( $Itemid && $Itemid != $sess->getShopItemid() ) {
         return;
      }

doorknob

  • Jr. Member
  • **
  • Posts: 151
Re: Bug: Duplicated breadcrumbs
« Reply #9 on: December 29, 2009, 11:22:26 am »
Quote
So the final should be:

// Only add the extra pathway if the menu item is using the default VM Itemid
      $global $sess;
      $Itemid = $_REQUEST['Itemid'];
      if( $Itemid && $Itemid != $sess->getShopItemid() ) {
         return;
      }

The original post does include this (added into the existing global statement)

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Bug: Duplicated breadcrumbs
« Reply #10 on: December 30, 2009, 09:54:52 am »
Hmmm, late night I guess. Not as smart as a doorknob :( Thanks.

randomperson

  • Beginner
  • *
  • Posts: 16
Re: Bug: Duplicated breadcrumbs
« Reply #11 on: September 21, 2010, 01:38:04 am »
is this going to get fixed in the official release or something...?

by the way, this `fix` creates a new issue, when browsing for the product itself it won't display breadcrumb for it at all (when there is a joomla menu assigned to the specific category)

doorknob

  • Jr. Member
  • **
  • Posts: 151
Re: Bug: Duplicated breadcrumbs
« Reply #12 on: September 24, 2010, 00:30:46 am »
Quote
by the way, this `fix` creates a new issue, when browsing for the product itself it won't display breadcrumb for it at all (when there is a joomla menu assigned to the specific category)
Works OK on my site. Take a look here http://www.eyeforabargain.co.uk/Bargains-Bazaar/Newfix-Car-Seat-Panama.html for example.

kelsay

  • Beginner
  • *
  • Posts: 40
Re: Bug: Duplicated breadcrumbs
« Reply #13 on: September 28, 2010, 20:40:57 pm »
Hi doorknob!  Sorry to intrude on this thread...

I too have a problem with my breadcrumbs not being okay.
They are fine for most pages and products, except the My Account and CART links are not.
I get HOME -> CATEGORY -> CART while it should say  HOME -> CART.

I have tried to find " $Itemid = $_REQUEST['Itemid'];" in my mainframe.class.php but it is not there. I'm using 1.5.20 and 1.1.15.

Can you help me with this?




doorknob

  • Jr. Member
  • **
  • Posts: 151
Re: Bug: Duplicated breadcrumbs
« Reply #14 on: October 03, 2010, 00:43:07 am »
Quote
I have tried to find " $Itemid = $_REQUEST['Itemid'];" in my mainframe.class.php but it is not there
The mod I posted was designed to change the way that the breadcrumbs are generated when a page is linked to a menu item. VM links every page to its own home page by using the $sess->getShopItemid() function (although that function has a bug because the sql it uses is not sufficiently selective in all cases). If, like me, you want to be able to use the Joomla security and configuration features that are associated with menu items, rather than treay the whole of VM as a single page then it is necessary to make the change I posted. The "$Itemid = $_REQUEST['Itemid'];" code identifies the itemid associated with the menu item that called the current page and is not the way that VM usually works.

I don't use the cart and so I can't replicate your issue. Unless your cart is linked to a menu item then I would not expect this patch to be responsible. If it is linked to a menu item, I suggest that you include Itemid=nn in the menu item url, where nn is the itemid of the VM home page (find the id of your main vm menu item in the menu editing area). If you are using sef, don't forget to clear the cache.
Regards
Phil