SEF URL to products correct, but redirected to index.php?option=com_virtuemart

Started by nickelas, July 31, 2012, 15:01:18 PM

Previous topic - Next topic

jjk

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.

Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

nickelas

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
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

cristirp

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)

ngd

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!

Barb_WHUK

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.

anisimow

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.

franzpeter

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.

anisimow

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.

franzpeter

@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.

anisimow

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?

jjk

@anisimow
I wonder if your problem might actually be a configuration problem, because most VM user's don't have that problem.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations