VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: georgebrindeiro on August 11, 2012, 14:37:09 PM

Title: SEO not working for Product Pages
Post by: georgebrindeiro on August 11, 2012, 14:37:09 PM
With SEO enabled, the link to the product page becomes:
http://www.mysite.com/component/virtuemart/product-seo_suffix

Instead of:
http://www.mysite.com/JoomlaMenuLink/VMcategory/product-seo_suffix

The problem seems to be in the way the link to the product page is generated (/components/com_virtuemart/views/category/tmpl/default.php).

This was cross-posted in the SEO forum:
http://forum.virtuemart.net/index.php?topic=104846.0 (http://forum.virtuemart.net/index.php?topic=104846.0)

But since it wasn't solved yet I thought it might be useful to post it here.
Title: Re: SEO not working for Product Pages
Post by: georgebrindeiro on August 11, 2012, 15:07:18 PM
In case anyone wants to look into this, the problem is in fact with the way $product->link is re-routed.

In line 791 of administrator/components/com_virtuemart/models/product.php:

$product->link = JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->_id . '&virtuemart_category_id=' . $productCategory);

So the way I see it (as a complete beginner) JRoute is the one who is messing things up.

I couldn't find a similar line in other models to find the fix, so I'm just reporting whatever I could figure.
Title: Re: SEO not working for Product Pages
Post by: georgebrindeiro on August 11, 2012, 15:26:34 PM
I might have found a fix, although I have not tested if this breaks anything (so I'd appreciate if someone could comment on this).
As an awesome additional side-effect, I noticed that my breadcrumbs work as I expected them to!

My solution is simply commenting out lines 146-147 of components/com_virtuemart/router.php:

/*if ($categoryRoute->itemId) $query['Itemid'] = $categoryRoute->itemId;
else $query['Itemid'] = $jmenu['virtuemart'];*/
Title: Re: SEO not working for Product Pages
Post by: jjk on August 11, 2012, 16:58:59 PM
In most cases the reason is an incorrect or missing Joomla menu item setting.
You might have a look at this: http://forum.virtuemart.net/index.php?topic=105254.msg350455#msg350455 (http://forum.virtuemart.net/index.php?topic=105254.msg350455#msg350455)
Make shure that all your VM2 categories have a menu link. If you deleted menu links, sometimes Joomla keeps obsolete menu items in its database table, which also results in SEF urls not working. But the latter should be pretty rare.
Title: Re: SEO not working for Product Pages
Post by: bazmahti on December 04, 2012, 07:07:01 AM
I am having the problem that sef urls are not appearing on product pages in Virtuemart 2.0.14 (used as a catalogue) on Joomla 2.5.8.

SEF friendly URLS are switched on in the Joomla Global Config and in Virtuemart. I have rebuilt the .htaccess file using admin tools and have created a menu link for every catagory. Here is an example what is displayed:

http://chairimports.com.au/european-beech-chairs/c038-50618e28d9a86-detail

Can anyone assist me to get this working correctly ?

Thanks!
Title: Re: SEO not working for Product Pages
Post by: jjk on December 04, 2012, 08:33:54 AM
I suppose that happens because you are stuffing your product title with keywords, thus creating extremely long titles. Your example link has the following title:
Chair Imports Ptd Ltd - Indoor Outdoor Furniture Import Export and Wholesale. Suppliers to Restaurants, Aged Care, Domestic and Interior Designers - European Beech Chairs : Bentwood Caro Arm Chair (196 characters).

The maximum allowed by Virtumart is 180 characters. The maximum which makes sense for Google is 60 to 70 characters.
Title: Re: SEO not working for Product Pages
Post by: bazmahti on December 04, 2012, 21:39:10 PM
Well thanks for that suggestion.  I removed the keywords from the site name and that should then have produced a product page url which should be around 65 characters but unfortunately it didn't make any difference. Is that still too many characters? The product URL still returns:

http://chairimports.com.au/european-beech-chairs/c038-50618e28d9a86-detail

when it should be:

http://chairimports.com.au/european-beech-chairs/bentwood-caro-arm-chair

Can anyone please help me solve this problem?
Title: Re: SEO not working for Product Pages
Post by: jjk on December 04, 2012, 22:06:29 PM
Which one do you see in your database table (in your case prefix_virtuemart_product_en_gb, I suppose) in the 'slug' column? The random number or the product name with dashes between the words, when you look at it with phpMyadmin or a similar MySQL tool? If you still have the numbers try to save the short title in VirtueMart again (or directly in the database table).

Around 65 characters is fine.
Title: Re: SEO not working for Product Pages
Post by: bazmahti on December 05, 2012, 06:56:30 AM
Thanks for your reply. We migrated this site from Joomla 1.5. I have noticed that the product aliases contain a code like series of numbers and letters. Likewise in the slug viewed via phpmyadmin. However when I deleted this in some test products and resaved which put the product title into the alias field it did not change the resulting url. I purged the cache to view this. So I am still mystified what do do. Any other suggestions?
Title: Re: SEO not working for Product Pages
Post by: jjk on December 05, 2012, 19:25:58 PM
Quote from: bazmahti on December 05, 2012, 06:56:30 AM
Any other suggestions?

yes, but I don't know if they solve your problem :-)
1. The "slug" (Product Alias) has to be unique. You may check if your database table contains the product name from which it creates the 'Product Alias' already (Easy to see if you sort the "slug" column alphabetically). Normally VM2 would add a random number at the end of the "slug" if it is used already.
2. You could try to go to Tools - Tools & Migration and click on 'Install or if necessary update tables' (but I would backup the database first, in case it would make things worse for you)