How to Remove the Category ID from the Page Title in VirtueMart

A couple of days ago a customer approached us with the following problem: His Joomla’s VirtueMart shop was displaying the category ID in the title of the page of each category details page. So, for example, instead of having something as “Cheap TVs” as the page title, his page title was “72-Cheap TVs”. Obviously, this is a big hit when it comes to SEO.

Further examination of his website revealed that:

  • He was using sh404 for URL rewriting. (if only we had a penny everytime someone had a problem with this extension!)
  • He enabled sh404 for his VirtueMart shop.
  • He chose to Insert the category ID in the URL. (this is a setting in the sh404 settings for VirtueMart)

Here’s what we did to fix the problem:

  • We opened the file containing the code responsible for adding the category ID – this file is components/com_sh404sef/meta_ext/com_virtuemart.php
  • We found the function vm_sef_get_category_title (which can be usually found at line 63 of the above file)
  • We changed the following code:

    $title .= ($sefConfig->shInsertCategoryId ?
        $tree[ $category_id ]->category_id.$sefConfig->replacement : '')
        .$tree[ $category_id ]->category_name. ' | ';


    $title .= $tree[ $category_id ]->category_name. ' | ';

  • That fixed the problem!

This is clearly a bug in sh404, but obviously the sh404 people don’t want to admit that it’s their problem, although the code that is behind this bug is clearly in one of their components/files.

If you are experiencing the same problem (where your page title in VirtueMart is displaying the category ID) or a similar problem (or even any other problem in Joomla) then feel free to contact us. We’re here to help, we’re efficient, we’re fast, we’re friendly, and we’re not expensive!

No comments yet.

Leave a comment