VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: nickelas on July 31, 2012, 15:01:18 PM

Title: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: nickelas on July 31, 2012, 15:01:18 PM
I have enabled "Search Engine Friendly URLs" and "Use URL rewriting" in the joomla config. Virtuemart categories work as expected, and the url to the products looks correct. But when clicking on one I am redirected to index.php?option=com_virtuemart
Anyone knows why?
Thanks
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: craftyweb on August 01, 2012, 12:18:30 PM
I'm having this problem too. Activated the SEO links in preparation to put the site live and none on the product pages will open!

If I select the 'Use Product and Category IDs' option the pages load but are completely empty, cannot figure out what is going on here.

Which version of VirtueMart are you using nickelas? I'm on 2.0.6. Just going to update to the latest version to check if it's still a problem.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: Cris91 on August 04, 2012, 23:24:03 PM
I've the same problem of nickelas. I'm using Joomla 2.5.4 and Virtuemart 2.0.6.
Anyone can help me?
Thanks
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: cristirp on August 11, 2012, 02:28:28 AM
It is happening to me too. Do you have products assigned to multiple categories? I'm wondering if that's the issue. I do have a link on the main menu to virtuemart, as I've read it is the way to go for SEF
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: lockwoodman on August 14, 2012, 02:52:46 AM
Ok, I've searched this forum for an answer to this problem and it seems like a hard one - i need the solution though.

For my VM to link properly (not back to category page) I have to have Joomla Global URL rewrite and sef on and VM config sef disabled checked.
I also have to have check translate strings - otherwise pagination links back to category also.

my site is http://timegallery.com.au
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: cristirp on August 14, 2012, 05:20:45 AM
How do you create a Joomla Global URL rewrite? and to rewrite from what? All the products are taking me to the main category page.
Thanks for the post and tips!
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: lockwoodman on August 14, 2012, 08:33:21 AM
In Joomla's global config URL rewrite is an option.

I'm mucking around with another fresh install of joomla and vm and think it might have had something to do with my template. Will keep searching.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: ivus on August 14, 2012, 10:12:10 AM
Hi everyone.

Have you checked that you have correctly set your .htaccess file in the root directory?

Also, in order for JOOMLA! to route properly, it requires that you have com_virtuemart set as a menu item so it can reference the alias name when routing.

I hope this helps.  ;D
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: pacbrother on August 14, 2012, 15:21:54 PM
Hi,

I had the same error. After test I found that this only happens when Seo Suffix is empty. Is this a bug? Is it really necessary to have a suffix in the product url?

Thanks,
Bruno
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: ivus on August 14, 2012, 15:30:52 PM
Hi pacbrother,

Shouldn't do. SEO_SUFFIX simply adds the ".html" to the end of the string. That's it.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: cristirp on August 18, 2012, 03:23:06 AM
It happens to me even with the SEO suffix off. I've also had the default Virtuemart added in the menu and noting. I've played with substituting that menu item with other Virtuemart menu options (categories, and such) but seems to make no difference.
I've also disabled the other menus in my website (left and footer) that contain Virtuemart features but haven't gotten it to work. It navigates through the category but as soon as I click on a product or product detail it takes me index.php?option=com_virtuemart

I have Beez20 as a template.
Here's the web: www.riovidastore.com (http://www.riovidastore.com)

Thanks for your help!
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: cristirp on August 18, 2012, 03:28:11 AM
@lockwoodman
Same here, if I check Disable SEO from Virtuemart and Translate Strings,  it does not redirect
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: jjk on August 18, 2012, 21:51:46 PM
Concerning the SEO suffix: VM2 doesn't work without a SEO suffix. It needs one to tell the system that it is on a product details page. See here:
http://forum.virtuemart.net/index.php?topic=103199.msg345832#msg345832 (http://forum.virtuemart.net/index.php?topic=103199.msg345832#msg345832)
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: lockwoodman on August 19, 2012, 17:08:23 PM
Weird - Mine has come good now. I now only am using the VM Front Page Menu Item(it is as good as the categories page if you disable latest and featured) and have all boxes on the seo config page empty. It's working now.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: cristirp on August 21, 2012, 04:24:24 AM
I'm very, very confused. I've tried all sorts of combinations and still have issues when the boxes on the VM seo config are empty. The Main menu item for VM goes to one of the categories layout (doesn't work either with the Default). I've turned off all other VM menu links, except for the one in the main menu.
All the combinations I've tried always end up in the same... once I click on a product, I get redirected to the VM main page. Is there something I have to change on the .htaccess file?

Thanks for the help!!!
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: jjk on August 21, 2012, 09:04:55 AM
Which versions of Joomla/VM2 are you using?
Your current non-sef URL looks like this:
http://www.riovidastore.com/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=19&virtuemart_category_id=3&Itemid=299&lang=en
I wonder what the "Itemid=299" is. I think this part shouldn't be there. You can check that in your database.

The recommended SEF settings are:
In Joomla configuration, set 'Adds Suffix to URL' to "No"
In VM2 configuration, set
'SEO Disabled' to "Off" (= unchecked)
'Seo Suffix' to "-detail" (or "shop" or "htm" or whatever you want).  DO NOT leave this field empty. Otherwise switching between categories and products will frequently fail.

BTW - if you change SEF settings, you will normally have to clear your Joomla and browser cache to pick up the changed settings.

Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: nickelas on August 22, 2012, 16:33:50 PM
Quote from: jjk on August 18, 2012, 21:51:46 PM
Concerning the SEO suffix: VM2 doesn't work without a SEO suffix. It needs one to tell the system that it is on a product details page. See here:
http://forum.virtuemart.net/index.php?topic=103199.msg345832#msg345832 (http://forum.virtuemart.net/index.php?topic=103199.msg345832#msg345832)
This is my experience aswell. Everything works as expected when having something in Virtuemarts "SEO >> Seo Suffix". When it is empty, clicking on a product gets you to the mainpage.
Maybe it should be added to the upgrade docs that Joomla 2.5 / Virtuemart 2 requires you to change product-URLs?
Joomlas redirect component should come in handy, or is it possible to create a regular expression? I mean for redirecting to the new urls with the suffix
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: cristirp on August 23, 2012, 02:19:48 AM
FIXED!!!!   :D :D :D :D :D

For the record, I have Joomla! 2.5.6 and VM 2.08.e.

I misunderstood the importance of the Seo Suffix. I was messing with the Joomla SEO suffix settings, not the VM SEO Suffix parameter. That did the trick with the settings from jjk.

I had turned off SEF and that's why you had seen that link.
http://www.riovidastore.com/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=19&virtuemart_category_id=3&Itemid=299&lang=en

Now it looks like:
http://www.riovidastore.com/en/component/virtuemart/vegetarian-certifications/halal/4life-transfer-factor-chewable-tri-factor-formula-riovidashop?Itemid=0

The only strange thing is that it still has that Itemid=0 part ... Also, it doesn't matter what value I put (Itemid=0, Itemid=299, Itemid=28, Itemid=2, ... etc), it still takes me to the same page. What's there to see in the database? Pardon my ignorance. I'll look into it.


Thanks everyone for all your help!!!! You guys are awesome  8)
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: ngd on October 30, 2012, 07:20:01 AM
Just came accross this - the url's base off where you create your 'front page' menu item.   if that is your home menu item - then all items, categories etc will display on your 'home' page when clicked on. (as in - you'll be redirected to home page showing item)     If this doesn't suit your needs, simply put your 'front page' menu item on another page, like 'products' and then your url's will be more logical.   ie - yourdomain.com/products/catname   as opposed to yourdomain.com/catname if your front page is in the home menu item.

Hope this makes sense and helps someone out there!
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: Barb_WHUK on November 10, 2012, 15:32:16 PM
Well I had come here to seek solution to the issue faced by one of our clients but it seems there are many who. So just thought of jumping onto the forum and reporting it here.
I tried working on the lines as suggested by few of the members above but just don't happen to find a fruitful solution. Though I'll save the url for future ref. on this. Let me keep trying as well, I'll post it here if a solution is reached.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: anisimow on April 24, 2013, 20:19:26 PM
Quote from: nickelas on July 31, 2012, 15:01:18 PM
I have enabled "Search Engine Friendly URLs" and "Use URL rewriting" in the joomla config. Virtuemart categories work as expected, and the url to the products looks correct. But when clicking on one I am redirected to index.php?option=com_virtuemart
Anyone knows why?
Thanks
I gas I've solved your problem.
I had the same problem. In my case (and I'm sure that in your too) the problem is in constant global variable VMLANG. It hasn't defined yet. And It cant find product_id. For example part query is FROM `#__virtuemart_products_'.$this->vmlang.'` AS `p` where $this->vmlang = VMLANG but must bee "en-en" or another language. Then it will find correct product_id.
So you must defined VMLANG. components/com_virtuemart/router.php  after line 2 " if(  !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );" add

if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'config.php');
VmConfig::loadConfig();
VmConfig::setdbLanguageTag();

for mee it works perfectly. Good luck.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: franzpeter on April 25, 2013, 10:50:03 AM
I do not think that it can solve any problem. You say: FROM `#__virtuemart_products_'.$this->vmlang.'` AS `p` needs a language definition. It is a sql query to retrieve something from the table, which contains the product descriptions, slugs and meta tags. '.$this->vmlang.' just produces something like #__virtuemart_products_en_gb, or #__virtuemart_products_de_de for example. VM saves all language dependent parts in a language table. If you use for example two languages like en_gb and de_de the query above just tries to find the actually used language.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: anisimow on April 26, 2013, 18:17:45 PM
Quote from: franzpeter on April 25, 2013, 10:50:03 AM
I do not think that it can solve any problem. You say: FROM `#__virtuemart_products_'.$this->vmlang.'` AS `p` needs a language definition. It is a sql query to retrieve something from the table, which contains the product descriptions, slugs and meta tags. '.$this->vmlang.' just produces something like #__virtuemart_products_en_gb, or #__virtuemart_products_de_de for example. VM saves all language dependent parts in a language table. If you use for example two languages like en_gb and de_de the query above just tries to find the actually used language.
In first you should tested it on your wrong sight and than write your opinion. Because this is just empty words. In my cases it really works,because
global variable VMLANG havent been defined at all, an I had bad sql request something like this #__virtuemart_products_VMLANG not #__virtuemart_products_de_de that's why it coudnt get product id.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: franzpeter on April 26, 2013, 19:58:34 PM
@anisimow,
sorry, I did not want to criticise your approach, everything what can help to solve problems is good. I just did want to say, that the problem must be somewhere inside the code of router.php, maybe a typo error which prevents to load the language variable or maybe a needless space sign or something like that, which prevents to call the correct function. Your approach does work and is helpful, but if there is a bug in the router.php your patch may be necessary for every update. It is better to find the true bug.
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: anisimow on April 26, 2013, 23:17:32 PM
I'm agree. Wee both are here  to share or solved some bugs and to help. I'm interesting whether it helps someone or only for me?
Title: Re: SEF URL to products correct, but redirected to index.php?option=com_virtuemart
Post by: jjk on April 26, 2013, 23:48:23 PM
@anisimow
I wonder if your problem might actually be a configuration problem, because most VM user's don't have that problem.