Author Topic: $Itemid problem with mainmenu  (Read 52078 times)

LEGOmanden

  • Beginner
  • *
  • Posts: 3
$Itemid problem with mainmenu
« on: July 11, 2008, 11:34:21 am »
Setup:
Joomla 1.0.15
Virtuemart 1.1.1

File with problem: joomlaroot/administrator/components/virtuemart/html/shop.product_details.php
Line 40:
$Itemid = $sess->getShopItemid();

This resets the Itemid for the rest of the joomla :-(.
I'm using the option joomla mainmenu to create component-link to products in virtuemart so I can control modules on each productpage.
When joomla starts loading modules it then has a wrong $Itemid and the modules is no longer in control :-(
Further more I'm using sh404SEF and it's getting the wrong $Itemid for products and messes it up :-(

What happens, when I start using virtuemart as a shop instead of a catalog?
What about othere pages such as shop.browse (the category page in virtuemart)?

I have done a temp-fix resetting the Itemid in the bottom of the shop.product_details.php to $Itemid = $_REQUEST['Itemid']

Does anyone know a complete fix to this isue? Or is it a bug to be handled in the next virtuemart version?
It's just like LEGO - but in code! Not in plastic

Soeren

  • Administrator
  • Sr. Member
  • *
  • Posts: 3106
  • VirtueMart Starter
    • virtuemart.net
Re: $Itemid problem with mainmenu
« Reply #1 on: July 21, 2008, 13:24:41 pm »
Hi,
how is it if you put the code under the pre-last line in the file virtuemart.php:

Code: [Select]
$Itemid = vmrequest::getint('Itemid');
$vm_mainframe->close();
?>

Please try that and report back...
The future of eCommerce: VirtueMart & Joomla!
http://virtuemart.net

LEGOmanden

  • Beginner
  • *
  • Posts: 3
Re: $Itemid problem with mainmenu
« Reply #2 on: July 21, 2008, 16:43:06 pm »
Hey Sören and Thanx for the idea :-)

It's going the right way but...
It is correct, than virtuemart when it is done has the Itemid set to the origninal but when it comes to shop.browse the problem is a little bit more complex :-(

I product listet in shop.browse has a link to the shop.product_details and this link is stil with the $Itemid from virtuemart, and not the $Itemid from the mainmenu.

Cind regards


It's just like LEGO - but in code! Not in plastic

razor7

  • Jr. Member
  • **
  • Posts: 325
    • MGSCreativa - Professional VM!
Re: $Itemid problem with mainmenu
« Reply #3 on: July 25, 2008, 00:00:31 am »
The same happens to me...

Please check out this site, http://www.escuela55.com.ar/inkpaper/opcion1
If you click the "BIC" logo, then all the BIC products will show up, but as you can see, there are a lot of products, so there is pagination.

The pagination results, override the given Itemid! I get allways Itemid=169 ¿?

Applied the patch suggested by soeren but nothing happens!

Please help!
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

razor7

  • Jr. Member
  • **
  • Posts: 325
    • MGSCreativa - Professional VM!
Re: $Itemid problem with mainmenu
« Reply #4 on: July 25, 2008, 00:49:06 am »
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

razor7

  • Jr. Member
  • **
  • Posts: 325
    • MGSCreativa - Professional VM!
Re: $Itemid problem with mainmenu
« Reply #5 on: July 29, 2008, 19:49:15 pm »
Hello...any chance to review or fix this issue...it is driving me crazy!

 

Thanks a lot!
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

LEGOmanden

  • Beginner
  • *
  • Posts: 3
Re: $Itemid problem with mainmenu
« Reply #6 on: July 29, 2008, 23:43:32 pm »
Hello... and no :-(

Nothing new and interesting... It seems that Sören has got something to think about *he he*
I guess they have'nt thougth that much about their use of $Itemid i the shop :-(

I allso hope for a fix to this soon.. I have to productionsites running virtuemart where I have this problem ..
It's just like LEGO - but in code! Not in plastic

Tri

  • Beginner
  • *
  • Posts: 1
Re: $Itemid problem with mainmenu
« Reply #7 on: August 01, 2008, 09:44:06 am »
Hello.

In administrator/components/com_virtuemart/classes/ps_session.php
At the beginning of the method getShopItemid() of the class ps_session
Try to add this :
if(!empty($_REQUEST['Itemid']))
         $_REQUEST['shopItemid'] = $_REQUEST['Itemid'];

razor7

  • Jr. Member
  • **
  • Posts: 325
    • MGSCreativa - Professional VM!
Re: $Itemid problem with mainmenu
« Reply #8 on: August 04, 2008, 18:59:05 pm »
It Works!

The ItemID, keeps the same as assigned to the menu, so i can assign many modules to a given product category!

Thanks again.

PS: Posted the workaround in the bugtracker too.
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

empati

  • Beginner
  • *
  • Posts: 5
Re: $Itemid problem with mainmenu
« Reply #9 on: October 10, 2008, 09:23:59 am »
Thanks you very much for the solution.

darkos

  • Beginner
  • *
  • Posts: 2
Re: $Itemid problem with mainmenu
« Reply #10 on: October 16, 2008, 11:20:53 am »
info: Joomla 1.5.7 + VM 1.1.2
*I also resolve this:
in administrator/components/com_virtuemart/classes/ps_session.php

*find:

if( !defined( '_VM_IS_BACKEND' )) {
         $Itemid = "&Itemid=".$this->getShopItemid();

*after:

"&Itemid="

*write some number:

"&Itemid=22"

*Save and exit ;D

loiseau

  • Beginner
  • *
  • Posts: 31
Re: $Itemid problem with mainmenu
« Reply #11 on: November 16, 2008, 13:08:09 pm »
Hello.
In administrator/components/com_virtuemart/classes/ps_session.php
At the beginning of the method getShopItemid() of the class ps_session
Try to add this :
if(!empty($_REQUEST['Itemid']))
$_REQUEST['shopItemid'] = $_REQUEST['Itemid'];

It works ! That's cool but there is another problem with the "related products"

Ex : flypage = product 1 / cat 1 + related products = product 2 / cat 4 ...

The product 2 is linked but the itemid stay in cat 1 :(


The "itemid" problem is very important ! Hope to fix that in the next update of Virtuemart, please :) Thanks !

Config : Joomla 1.5.8 - Virtuemart 1.1.2

MiRcOv

  • Beginner
  • *
  • Posts: 12
Re: $Itemid problem with mainmenu
« Reply #12 on: December 12, 2008, 15:12:33 pm »
Hi at all, i'm arriving late but i've another solution that i think is better (i'm also preparing a live demonstration of the bug).

The original function is

Code: [Select]
function getShopItemid() {
if( empty( $_REQUEST['shopItemid'] )) {
$db = new ps_DB;
$db->query( "SELECT id FROM #__menu WHERE
...

You had modified the behavior of the function by changing the if ( if( !empty... ). It is not correct for me. The function is designed to work as is now.

The edit that can be made is another:

Try to edit the function in this way

Code: [Select]
function getShopItemid() {

if( empty( $_REQUEST['shopItemid'] )) {
$db = new ps_DB;
$db->query( "SELECT id FROM #__menu WHERE link='index.php?option=com_virtuemart' AND published=1");
if( $db->next_record() ) {
$_REQUEST['shopItemid'] = $db->f("id");
}
else {
if( !empty( $_REQUEST['Itemid'] )) {
$_REQUEST['shopItemid'] = intval( $_REQUEST['Itemid'] );
}
else {
$_REQUEST['shopItemid'] = 1;
}
}

// HERE STARTS THE HACK
} else {
return intval($_REQUEST['Itemid']);
}
// HERE ENDS THE HACK
return intval($_REQUEST['shopItemid']);

}

The function is the same but if an Itemid is set the function does not changes it. And this is what we want ;):)

Lylene

  • Jr. Member
  • **
  • Posts: 118
Re: $Itemid problem with mainmenu
« Reply #13 on: December 18, 2008, 16:33:40 pm »
Thanks for this info, I have been looking for a solution for weeks, with this Item Id problem. Now Item id mentionned is that of the menu. However, I need to have the breadcrumb to be displayed on each product page, and it seems it is not working with that modification.

I confirm : breacrumb module is properly set up + breadcrumbs were displayed before the change (BUT with the wrong ItemId).

Thanks for your help much appreciated !


Lylene

  • Jr. Member
  • **
  • Posts: 118
Re: $Itemid problem with mainmenu
« Reply #14 on: December 18, 2008, 17:04:34 pm »
Sorry me again : apparently, the breadcrumb works ok if we are using it from standard browse page. However, all my products are also introduced via VM Latest Products module and breadcrumbs are not displayed on product page when coming from that module.

I finally found the problem on this issue, the breadcrumbs are dispayed only if the source page is authorising them : on homepage, there was no breadcrumbs displayed, clicking on a product from there makes it imposible to display breadcrumbs on the related product page. The solution was to display breadcrumbs on the homepage.