VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: peteward15 on April 22, 2015, 16:44:33 PM

Title: SEF URL Menu and Sub Category Errors
Post by: peteward15 on April 22, 2015, 16:44:33 PM
HI All

I'm working on a site using VM 3.0.6.2 and we have a strange error.

On the main drop down menu we can click some categories and teh flyout menu allows us to select a sub category and the URL is as it should be for example:  www.ourdomain.com/parentmenuname/categoryname/subcategoryname

We can click that and correctly view the products in the sub catgory.

However if we click on the main menu the category we arrive at the VM category page with the URL:  www.ourdomain.com/parentmenuname/categoryname

And we can see our subcategories here.  And here is the problem.  On some subcategories the sub category URL isn't as it should be it changes to: www.ourdomainname.com/component/virtuemart/?Itemid=116  (or some other random number) and naturally this doesn't send us to the correct location.

To complicate the problem it doesn't seem to happen every time you click it seems to be fairly random.

Any help or assistance anyone could shine on this would be greatly appreciated,

Cheers

Title: Re: SEF URL Menu and Sub Category Errors
Post by: Studio 42 on April 22, 2015, 20:56:32 PM
Hi,
First : try disabling your Joomla cache and clear the joomla cache.
If you have a multilanguage shop, please verify your categoy exist in all languages.
If the module is not from virtuemart then contact the module author, perhaps he have made a mistake in the code.

Greets,

Patrick
Title: Re: SEF URL Menu and Sub Category Errors
Post by: peteward15 on April 23, 2015, 08:52:12 AM
Thanks Patrick.  I have tried the cache already.

"If the module is not from virtuemart then contact the module author, perhaps he have made a mistake in the code." - What module do you mean? 

When you click the category surely you are then viewing the virtuemart subcategory view?
Title: Re: SEF URL Menu and Sub Category Errors
Post by: Studio 42 on April 23, 2015, 16:07:34 PM
When you get this link ? www.ourdomainname.com/component/virtuemart/?Itemid=116
this can come when the route is not set, then you have to know in wich case you get this.
On clicking in the category module,
on clicking the categories page
in the product
.... ?
Title: Re: SEF URL Menu and Sub Category Errors
Post by: peteward15 on April 23, 2015, 16:17:48 PM
We get that link when we have clicked a top level category and reached the sub category display screen.  It is by clicking on the sub category from here which sometimes links to that link.
Title: Re: SEF URL Menu and Sub Category Errors
Post by: Studio 42 on April 23, 2015, 16:22:25 PM
hi,
Try the default joomla template. to know if this problem is not from your template
Title: Re: SEF URL Menu and Sub Category Errors
Post by: peteward15 on April 27, 2015, 18:41:02 PM
I today tested the site using the default Beez and Protostar templates and the exact same problem occurs!!!  How frustrating!  Do you have any other ideas?
Title: Re: SEF URL Menu and Sub Category Errors
Post by: peteward15 on May 10, 2015, 21:21:33 PM
Still struggling with this.  Just to recap I am running VM 3.0.6.2 and Joomla 3.3.6 - somebody on another forum told me that the two aren't compatible and this could be the cause of my problem.  Is this true?!?!?!

Any advice would be welcome!

Title: Re: SEF URL Menu and Sub Category Errors
Post by: Studio 42 on May 10, 2015, 22:04:21 PM
Try to disable sef rewriting and 3party sef, if you use one.
Title: Re: SEF URL Menu and Sub Category Errors
Post by: GJC Web Design on May 10, 2015, 22:37:04 PM
1.
QuoteI am running VM 3.0.6.2 and Joomla 3.3.6 - somebody on another forum told me that the two aren't compatible and this could be the cause of my problem.  Is this true?!?!?!

wrong - rubbish

2.
Quotewww.ourdomainname.com/component/virtuemart/?Itemid=116

this means that somewhere in your install is a menu already set to this cat -- it has the Itemid of 116

look thru ALL your menu items (inc. trash and unpublished)  looking for this id number  (last column)
Title: Re: SEF URL Menu and Sub Category Errors
Post by: erhabe on May 10, 2015, 23:35:04 PM
I also have a problem like this

VM 3.0.8 and J 3.4.1

I have set menus for category and submenus for each manufacturer .When i click on a product the manufacturer name is same .

http://test.sportmaniax.ro/ro/off-road

I created menus for subcategory ATV and submenus for each manufacturer from ATV.

http://test.sportmaniax.ro/ro/off-road/atv/arctic-cat
(http://test.sportmaniax.ro/ro/off-road/atv/arctic-cat)
http://test.sportmaniax.ro/ro/off-road/atv/can-am
(http://test.sportmaniax.ro/ro/off-road/atv/can-am)
and so on.....

When i go on
http://test.sportmaniax.ro/ro/off-road/atv/arctic-cat
(http://test.sportmaniax.ro/ro/off-road/atv/arctic-cat)
and click on a product the link is gonna be
http://test.sportmaniax.ro/ro/off-road/atv/yamaha/700-diesel-trv-3in1-eft-detail

instead

http://test.sportmaniax.ro/ro/off-road/atv/arctic-cat/700-diesel-trv-3in1-eft-detail
Title: Re: SEF URL Menu and Sub Category Errors
Post by: Studio 42 on May 11, 2015, 12:18:09 PM
IF you are in a category or product, the menu (and menu id) is always set to the category or first parent category or to the main shop page.
The manufacturer is always the first subfolder after the menu link when you are in the category .
When you are in the product, the manufacturer is not set in the Url.
Because Max said, he don't  want change anythink for now in the router. i don't provide temp fixes. BUt simply search in front-end files the router.php for
Quotecase 'productdetails';
Youur new code is to enter here
Title: Re: SEF URL Menu and Sub Category Errors
Post by: erhabe on May 11, 2015, 13:29:16 PM
I looked at router.php but i dont want to eliminate the manufacturer name in product url.I just only want to take the proper manufacturer name instead on taking only one manufacturer for all products.
Title: Re: SEF URL Menu and Sub Category Errors
Post by: Studio 42 on May 11, 2015, 15:40:42 PM
I think you have set so many overide in the menu, that the end result is bad.
I explained before how the link work. But you have added manufacturer in a menu> in a category. This case was never tested.
Title: Re: SEF URL Menu and Sub Category Errors
Post by: erhabe on May 11, 2015, 16:00:44 PM
I unpublished the menu and let just 2 categorys....arctic cat and cf moto.

http://test.sportmaniax.ro/ro/arctic-cat
http://test.sportmaniax.ro/ro/cf-moto

The result is the same when i click on one product from arctic cat.....it takes the cf moto manufacturer name on url.
No more overrides only 2 menus with category and manufacturer set.

When i create menu i have 2 options to choose category and manufacturer.You say its bad to select both options?Only to select category or manuf?
Title: Re: SEF URL Menu and Sub Category Errors
Post by: peteward15 on May 11, 2015, 18:35:07 PM
Quote from: GJC Web Design on May 10, 2015, 22:37:04 PM

2.
Quotewww.ourdomainname.com/component/virtuemart/?Itemid=116

this means that somewhere in your install is a menu already set to this cat -- it has the Itemid of 116

look thru ALL your menu items (inc. trash and unpublished)  looking for this id number  (last column)

I have looked at what you have said and this is what I found.

In one example from the dropdown menu the link is correct and it is:  www.ourdomain.com/store-a-g/eks-engel-gmbh/fimp-patch-splice-box

This takes you to the correct subcategory.  However if you click the category eks engel and view the sub categories and click the sub cat fimp patch the destination URL becomes:

www.ourdomain.com/component/virtuemart/?Itemid=114

I have looked in the sites main drop down menu setup and sure enough the item ID for the menu item is indeed 114.   

Title: Re: SEF URL Menu and Sub Category Errors
Post by: erhabe on May 11, 2015, 19:30:57 PM
I think i know why i have this bug when i create menu sorted after category and manufacturer.
I disabled sef and i have this url for category
/index.php?option=com_virtuemart&view=category&virtuemart_category_id=8&virtuemart_manufacturer_id=4&categorylayout=0&showcategory=0&showproducts=1&productsublayout=0&Itemid=145&lang=ro

and this when i click on a product from that category
/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=130&virtuemart_category_id=8&Itemid=145&lang=ro

On router.php at productdetails

case 'productdetails';

$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
} else {
if(isset($query['virtuemart_product_id'])) {
if ($helper->use_id) $segments[] = $query['virtuemart_product_id'];
$virtuemart_product_id = $query['virtuemart_product_id'];
unset($query['virtuemart_product_id']);
}
if(empty( $query['virtuemart_category_id'])){
$query['virtuemart_category_id'] = $helper->getParentProductcategory($virtuemart_product_id);
}
if(!empty( $query['virtuemart_category_id'])){
$categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
if ($categoryRoute->route) $segments[] = $categoryRoute->route;
if ($categoryRoute->itemId) $query['Itemid'] = $categoryRoute->itemId;
else $query['Itemid'] = $jmenu['virtuemart'];
} else {
$query['Itemid'] = $jmenu['virtuemart']?$jmenu['virtuemart']:@$jmenu['virtuemart_category_id'][0];
}
unset($query['virtuemart_category_id']);

if($virtuemart_product_id)
$segments[] = $helper->getProductName($virtuemart_product_id);
}
break;


No Manufacturer string is located here.

On category

case 'category';
$start = null;
$limitstart = null;
$limit = null;

if ( isset($query['virtuemart_manufacturer_id'])  ) {
$segments[] = $helper->lang('manufacturer').'/'.$helper->getManufacturerName($query['virtuemart_manufacturer_id']) ;
unset($query['virtuemart_manufacturer_id']);
}
if ( isset($query['search'])  ) {
$segments[] = $helper->lang('search') ;
unset($query['search']);
}
if ( isset($query['keyword'] )) {
$segments[] = $query['keyword'];
unset($query['keyword']);
}
if ( isset($query['virtuemart_category_id']) ) {
$categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
if ($categoryRoute->route) {
$segments[] = $categoryRoute->route;
}
if(isset($query['virtuemart_category_id']) and isset($jmenu['virtuemart_category_id'][$query['virtuemart_category_id']])) {
$query['Itemid'] = $jmenu['virtuemart_category_id'][$query['virtuemart_category_id']];
} else {
//http://forum.virtuemart.net/index.php?topic=121642.0
if (!empty($categoryRoute->itemId)) {
$query['Itemid'] = $categoryRoute->itemId;
} else {
$query['Itemid'] = vRequest::get('Itemid',false);
}
}
unset($query['virtuemart_category_id']);
}
if ( isset($jmenu['category']) ) $query['Itemid'] = $jmenu['category'];

if ( isset($query['orderby']) ) {
$segments[] = $helper->lang('by').','.$helper->lang( $query['orderby']) ;
unset($query['orderby']);
}

if ( isset($query['dir']) ) {
if ($query['dir'] =='DESC'){
$dir = 'dirDesc';
} else {
$dir = 'dirAsc';
}
$segments[] = $dir;
unset($query['dir']);
}

// Joomla replace before route limitstart by start but without SEF this is start !
if ( isset($query['limitstart'] ) ) {
$limitstart = $query['limitstart'] ;
unset($query['limitstart']);
}
if ( isset($query['start'] ) ) {
$start = $query['start'] ;
unset($query['start']);
}
if ( isset($query['limit'] ) ) {
$limit = $query['limit'] ;
unset($query['limit']);
}
if ($start !== null &&  $limitstart!== null ) {
//$segments[] = $helper->lang('results') .',1-'.$start ;
} else if ( $start>0 ) {
// using general limit if $limit is not set
if ($limit === null) $limit= vmrouterHelper::$limit ;

$segments[] = $helper->lang('results') .','. ($start+1).'-'.($start+$limit);
} else if ($limit !== null && $limit != vmrouterHelper::$limit ) $segments[] = $helper->lang('results') .',1-'.$limit ;//limit change

break;


On category strings for manufacturers are presents.
Does anyone know how to put manufacturer strings on productdetails case so the manufacturer name will be loaded on product url?