Monday, February 10, 2014

Virtuemart 2 - How to remove SEO Suffix from Product Details aka -detail

If your using Virtuemart 2+ it requires you to use a -detail or .html  as a suffix for product pages.  Which really sucks if you are use to using SH404sef or some other plugin that will correctly re-route your URLs and make them nice. SH404sef no longer works with Virtuemart thus we are stuck with the default router. Here is how I fixed the router.php (included at the bottom for your downloading pleasuere)

Since there is not a plugin I dove into the router.php and made some simple quick fixes to ignore the SEO_Suffix and load products.

Around line 633
Code looked for categories in the last segment

$vars['virtuemart_category_id'] = $helper->getCategoryId (end($segments) ,$helper->activeMenu->virtuemart_category_id);
    $vars['view'] = 'category' ;

Changed to
$product = $helper->getProductId($segments ,$helper->activeMenu->virtuemart_category_id);
    $vars['virtuemart_product_id'] = $product['virtuemart_product_id'];
   $vars['virtuemart_category_id'] = $product['virtuemart_category_id'];

//codepyro - removed suffix from router 
  //check if the last segment is a product. 
  //if so then load the product details page instead of category 
   $vars['view'] = 'productdetails';
   $vars['virtuemart_category_id'] = $helper->getCategoryId (end($segments) ,$helper->activeMenu->virtuemart_category_id);
   $vars['view'] = 'category' ;

Around line 943
//codepyro hack to remove suffix  
  if($this->seo_sufix_size >0)
   $productName =  substr($productName, 0, -(int)$this->seo_sufix_size );

You can download the updated router.php for Virtuemart 2.0.26d  

upload and replace the file

updated 3.14.14 - I didn't realize that the site I had made these adjustments to all of the categories were set as menu items which of course makes a big difference. Anyway the zip file has been updated with the latest router.

Stumble Upon CodePyro


Anonymous said...

Thank u for very helpful post!:) Can u help me a bit?
I need a suffix word, but I would like this order:
#suffix word - product title

I would be very grateful if you could help, thank you!

Josh Tischer :: CodePyro said...

Can you explain further what you are looking for? Is it something like

Josh Tischer :: CodePyro said...

Just got another comment and it appears to have been deleted. If you need help fixing this on your site, let me know.

Олег Луценко said...

Hi, Josh

Thanks for your fix, but it's doesn't work for Joomla 2.5.19 VM 2.0.26

I'll be very glad for your help

Josh Tischer :: CodePyro said...

send me your router file i would be happy to take a look. info at

Anonymous said...

Thenk you form Russia.

Олег Луценко said...

Hi, Josh
Thank you for help!!!
Your router.php is what I was looking for.
Best regards

Anonymous said...

hi, for J 2.5.20. no work :-( sorry can you upgrade it? thanks

Anonymous said...

this solution does not work on Virtuemart 2.6

jorg gray said...

Any company claiming to be an affordable Dallas Affordable SEO Services solution included, really should be adding value to your company

Mary Hickman said...

very unique blog

Affordable Search Engine Optimization

Anonymous said...

Hi Josh
Thank you for this hint...
But I'm now migrating to Virtuemart 3.x, and this hack seems not working anymore: do you have some suggestions to get it working again on new 3.x VM series? Thank you in advance for any help.

jorg gray said...

We provide white-hat SEO services that deliver long-term results to companies in the Dallas/Fort Worth area. Contact us now for a FREE SEO site audit affordable SEO Dallas.

faizan qureshi said...

You could have increased the very important concern.. thank you intended for revealing.. my spouse and i should browse much more provide problems with this weblog.. maintain putting up.. Web optimization Baclinks  Blog Commenting Service And Seo Services.

Muneer Ahmed said...

Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! dallas seo

Deborah Richards said...

Wonderful!! this is really one of the most beneficial blogs I’ve ever browsed on this subject. I am very glad to read such a great blog and thank you for sharing this good info with us.

Seo said...

Hello there, My spouse and i discover scanning this article a new enjoyment. It is quite very helpful and useful and extremely considerably looking forward to examining more of your do the job. All In One Seo Backlinks To Rank You In 5$

Richard C. Lambert said...

Which really sucks if you are use to using SH404sef or some other plugin that will correctly re-route your URLs and make them nice seo

Adiba Alam said...

Real part of the total populace is getting to web for host of purposes. Be that as it may, of these reason, the need to accumulate more data holds the need. said...

I love this blog!! The flash up the top is awesome!!

mayazoe said...

How do you promote your business with backlinks? There are of course several ways to promote your business and promoting it with backlinks is one of the very best.
link building services

devidmiller5060 said...

Technical writing blog is a virtual content on any technical concept, including, engineering, aeronautics, marine, geographical surveys, oil explorations, advertising, media, sound or for that matter anything which has a scientific relation.
fashion school

jowdjbrown said...

I couldn't have asked for a simpler read with great tips like this... Thanks! What do Internet Marketing services include

Best Globle Trend said...

If you have ever dreamed of working on Wall Street, then you might be an ideal candidate for a job with an SEO agency. That may seem like quite a stretch to go from stocks to search engine optimization, but both industries are quite chaotic and involve a lot of risk. link of my website

Unknown said...

Web Honkers is Canada’s leading digital marketing firm, with top rated SEO Experts who are committed to our client’s success with offices in Toronto, Canada and in London, UK.
SEO Company

luice barlow said...

It’s amazing to visit again n again coming to your blogs the superb effort is here

Roman lesnar said...
This comment has been removed by the author.
Roman lesnar said...

I'm not shure, because I never used sh404sef with Joomla 2.x. But my assumption is that the Joomla redirect manager will not catch a 404 page not found error, because VirtueMart will probably automatically redirect to your homepage. However, it should be possible to add the old url and the new url manually into the Joomla redirect manager. If you click on 'New' in the Joomla redirect Manager, a form with old url/new url shows up.
blog comments services

Robert F. Crocker said...

Thanks for sharing this quality information with us. I really enjoyed reading. Will surely going to share this URL with my friends.

Best Globle Trend said...

To have a brilliant start in your online business, it is very important to have the assistance of an SEO Company. For getting tied with the best SEO Company you can have a small research about the SEO services and then craft your pick. Do you think the task simple as it is? No, it is not. To choose a dependable Company is a tiring task.

Best Globle Trend said...

Planning to get SEO Services to make out your website and help you earn and market! The business is not going online. With the help of a website even small businesses are getting a chance to market their product online and sale. josh

Jhon Alex said...

You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. High Trust Flow

roni james said...

What?s Taking place i am new to this, I stumbled upon this I’ve discovered It positively helpful and it has aided me out loads. I hope to contribute & assist other customers like its aided me. Good job. blog marketing digital

roni james said...

Thanks a ton for this, I am greatful for the info blog marketing digital

roni james said...

I conceive you have noted some very interesting details , regards for the post. blog de seo

Robert F. Crocker said...

useful information on topics that plenty are interested on for this wonderful post.Admiring the time and effort you put into your b!.. best seo company in nepal

Post a Comment