I am new to VirtueMart and I have recently created a VirtueMart 2 site on Joomla 2.5 .
Using Joomla 2.5 standard SEO SEF settings - it seems to work perfectly apart from actual shop items where it adds ?Itemid=0 onto the end of each URL
I dont want this to appear at all - I want the URL to get to .html and that's it - I don't want any ?Itemid to show after the URL.
Can anyone give me some advice on how I can achieve this?
Many Thanks
Steven
Does anyone know how to fix this?
I am really not sure what I should be doing here - but maybe its something to do with the virtuemart component router.php file - can I edit anything here to stop the Itemid from displaying in the URL?
stevewc84, do you have a menu link to the vmart frontpage?
and are you saying it adds the Itemid=0 when SEF turned on?
are you using 3rd party sef component?
My problem is same
do you have a menu link to the vmart frontpage? ... YES
and are you saying it adds the Itemid=0 when SEF turned on? .... YES
are you using 3rd party sef component? .... NO
Did you find a solution to this?
Thank you :D
I'm having the same issue.
In the config it has a place in the SEO options to enable translation strings which from what I can tell would take care of the add-on item id at the end of the URL and it is checked but is in effective...
What's up?
The interesting thing I've discovered for my website is that it only happens for some products. There's some that have perfect SEF... but others have the Itemid=0 at the end as well as the component/virtuemart part after the domain.
I am also experiencing this issue but it appears to only be present on products that have custom fields associated with them
Same here. I'm using Joomla! 2.5.6 with VirtueMart 2.0.10 and the standard, build-in Joomla SEO. Any idea how to fix it?
I appear to have found a solution to this, my VM category that my product sat in was not assigned to a menu item. Creating a menu item linked to the VM category in question seemed to have solved it.
I already had a menu item with VM in it. However, I changed the menu item to Category Layout and selected the Top Level Category, and that fixed it!! :D Thanks for the tip
What is going on? It showes as exactly what you said, only those items that the categories not assigned to a menu item appeared such issue. However, I am using megamenu, no enough space for assigning all the categories to it.
Looking for another way out... ...
Any solution to that? My ItemId =0 is wrong too. How can I find the proper one???
Quote from: DH on October 04, 2012, 19:21:28 PM
What is going on? It showes as exactly what you said, only those items that the categories not assigned to a menu item appeared such issue. However, I am using megamenu, no enough space for assigning all the categories to it.
Looking for another way out... ...
use a hidden menu
ok, this might be an old topic but problem still exists in VM 2.0.22c
here is my quick fix/solution:
you have to edit router.php file that is located in /components/com_virtuemart/
somewhere around line 764 you will find a function called "getCategoryRouteNocache"
now you have to replace variable "$category->itemId" (line 768) with the code below:
$menu = JFactory::getApplication()->getMenu();
//get menu item with virtuemart link
$item = $menu->getItems('link', 'index.php?option=com_virtuemart&view=categories&virtuemart_category_id=0', false);
if ($item[0]->id < 0)
{
$item = $menu->getItems('link', 'index.php?option=com_virtuemart&view=virtuemart', false);
}
//set item id
$category->itemId = $item[0]->id;
this solutions also fixes the problem with SEF url for category module and all other modules that uses JRoute::_ function to generate links
the function looks now like this
/* Get Joomla menu item and the route for category */
public function getCategoryRouteNocache($virtuemart_category_id){
if (! array_key_exists ($virtuemart_category_id . $this->vmlang, self::$_catRoute)){
$category = new stdClass();
$category->route = '';
$category->itemId = 0;
$menuCatid = 0 ;
$ismenu = false ;
// control if category is joomla menu
if (isset($this->menu['virtuemart_category_id'])) {
if (isset( $this->menu['virtuemart_category_id'][$virtuemart_category_id])) {
$ismenu = true;
$category->itemId = $this->menu['virtuemart_category_id'][$virtuemart_category_id] ;
} else {
$CatParentIds = $this->getCategoryRecurse($virtuemart_category_id,0) ;
/* control if parent categories are joomla menu */
foreach ($CatParentIds as $CatParentId) {
// No ? then find the parent menu categorie !
if (isset( $this->menu['virtuemart_category_id'][$CatParentId]) ) {
$category->itemId = $this->menu['virtuemart_category_id'][$CatParentId] ;
$menuCatid = $CatParentId;
break;
}
}
}
}
if ($ismenu==false) {
if ( $this->use_id ) $category->route = $virtuemart_category_id.'/';
if (!isset ($this->CategoryName[$virtuemart_category_id])) {
$this->CategoryName[$virtuemart_category_id] = $this->getCategoryNames($virtuemart_category_id, $menuCatid );
}
$category->route .= $this->CategoryName[$virtuemart_category_id] ;
if ($menuCatid == 0 && $this->menu['virtuemart']) $category->itemId = $this->menu['virtuemart'] ;
}
self::$_catRoute[$virtuemart_category_id . $this->vmlang] = $category;
}
return self::$_catRoute[$virtuemart_category_id . $this->vmlang] ;
}
How do you mean it? Maybe the new functions fixes it, or you have a better method. Lets discuss it out :-)
sorry if I am not that clear :)
Now, in this function... you set
$category->itemId = 0;
and then you make some checks..
first check " if (isset($this->menu['virtuemart_category_id'])) " fails because we are not in any virtuemart category since we are in frontpage and virtuemart is not set as default homepage.
so we then go to the second check " if ($ismenu==false) ".... yes it's false because we have already set it before
then we have " if ($menuCatid == 0 && $this->menu['virtuemart']) " that fails to assign $this->menu['virtuemart'] to $category->itemId
because $this->menu['virtuemart'] is not set...
and that is how we stuck with $category->itemId = 0; that we have earlier defined.
I don't now if I am correct..
but that is what I thought and understood when I checked your code.
so what I did was to use joomla's methods to get an item id from the first menu item that will have " index.php?option=com_virtuemart&view=categories&virtuemart_category_id=0 " or " index.php?option=com_virtuemart&view=virtuemart "
and then set $category->itemId instead of just having it as 0
download router file from here http://www.netikon.gr/joomla-extensions
Sirinidis Nikolaos Thank You! Your router.php fix works! Great job :)
Hi, after going crazy for some days, and didn't want to touch the router.php core files, I discovered that my only two products that showed 'ItemId=0' had the field 'URL', in the 'Information' tab valorized!
I cleared the 'URL' field, and 'ItemID=0' disappeared, showing my SEF url as expected.
I hope this could help someone.
Bye.