Improve Virtuemart 1.1 metatags & SEO - Joomla & VirtueMart Tips & How To's

GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.

Home Joomla - VirtueMart Joomla 3.x/4x jPageViews Plugin

Sat

12

Jan

  • VirtueMart 1.1
  • Metatags

Below are some simple hacks to improve your VirtueMart 1.1 metatags especially the html title.

Html titles are critical to good search engine visibility and the meta description and meta keywords play a part as well. The standard Virtuemart 1.1. does make an effort to reflect the product in the metatags and html titles but just lists the product name as html title and the site global meta keywords. The product short description is used as the meta description so make sure that is relevant.

The standard metatags in our example would be:

Virtuemart 2.0 shipping module Postcode - ZIP code

and metatags of:

website design, Joomla, Templates, web site design, England, Britain, UK

But these can be improved with a couple of simple code hacks.

Firstly name the categories and if possible the manufacturers with some of your keywords - in my case things like Virtuemart, Joomla, Extensions etc.

virtuemart metatags_category_manufacturer 
This just allows us an easy interface to add the required keywords keywords.

Then open file administrator/components/com_virtuemart/html/shop.product_details.php around line 235 and replace this code:

// Set Dynamic Page Title
if( function_exists('mb_substr')) {
  $page_title = mb_substr($product_name, 0, 64, vmGetCharset() );
} else {
  $page_title = substr($product_name, 0, 64 );
 
}
$vm_mainframe->setPageTitle( @html_entity_decode( $page_title, ENT_QUOTES, vmGetCharset() ));
 
// Prepend Product Short Description Meta Tag "description"
if( vmIsJoomla('1.5')) {
  $document = JFactory::getDocument();
  $document->setDescription(strip_tags( $db_product->f("product_s_desc")));
} else {
  $mainframe->prependMetaTag( "description", strip_tags( $db_product->f("product_s_desc")) );
}
 


with

// Set Dynamic Page Title//GJC
$category_name = $ps_product_category->get_name_by_catid($category_id);
$manufacturer_name = $ps_product->get_mf_name($product_id);
if( function_exists('mb_substr')) {
  $page_title = mb_substr($product_name, 0, 128, vmGetCharset() ).'|'.$manufacturer_name.'|'.$category_name;
} else {
  $page_title = substr($product_name, 0, 128 );  
}
$vm_mainframe->setPageTitle( @html_entity_decode( $page_title, ENT_QUOTES, vmGetCharset() ));
 
// Prepend Product Short Description Meta Tag "description"
if( vmIsJoomla('1.5')) {
  $document = JFactory::getDocument();
  $document->setDescription(strip_tags( $db_product->f("product_s_desc")));
  $keys = str_replace('|',', ',$page_title);
  $document->setMetaData("keywords", $keys);
} else {
  $mainframe->prependMetaTag( "description", strip_tags( $db_product->f("product_s_desc")) );
}
 
 
This will give a html title of:

Virtuemart 2.0 shipping module Postcode - ZIP code|Virtuemart 2.0 Plugins|Joomla Downloads

and metatags of:

Virtuemart 2.0 shipping module Postcode - ZIP code, Virtuemart 2.0 Plugins, Joomla Downloads

Much better.

This idea can also be extended to the Category page (Browse page in Virtuemart speak) especially if your category description is relatively simple. You could use some string replacement to tidy the title.

virtuemart metatags_category_browse

Open file administrator/components/com_virtuemart/html/shop.browse.php around line 73.

Replace

if( $category_id ) {
  /**
    * CATEGORY DESCRIPTION
    */
  $db->query( "SELECT category_id, category_name FROM #__{vm}_category WHERE category_id='$category_id'");
  $db->next_record();
  $category_name = shopMakeHtmlSafe( $db->f('category_name') );
 
  // Set Dynamic Page Title
  $vm_mainframe->setPageTitle( $db->f("category_name") );
 
  $desc =  $ps_product_category->get_description($category_id);
  $desc = vmCommonHTML::ParseContentByPlugins( $desc );
  // Prepend Product Short Description Meta Tag "description" when applicable
  $mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) );
 
}
 
with
 
if( $category_id ) {
  /**
    * CATEGORY DESCRIPTION
    */
  $db->query( "SELECT category_id, category_name FROM #__{vm}_category WHERE category_id='$category_id'");
  $db->next_record();
  $category_name = shopMakeHtmlSafe( $db->f('category_name') );
 
  // Set Dynamic Page Title
  $desc =  $ps_product_category->get_description($category_id);
  $desc = str_replace(' & ','|',$desc);
        $desc = str_replace(' - ','|',$desc);
  $pagetitle = $desc."|".$db->f("category_name");
  $vm_mainframe->setPageTitle( $pagetitle );
  $desc =  $ps_product_category->get_description($category_id);
  $desc = vmCommonHTML::ParseContentByPlugins( $desc );
  // Prepend Product Short Description Meta Tag "description" when applicable
  $mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) );
  $keys = str_replace('|',', ',$pagetitle);
  $document = JFactory::getDocument();
  $document->setMetaData("keywords", $keys);
 
}
 


This will give a html title of:

VirtueMart|Joomla plugins|Joomla modules|VirtueMart 2 shipping plugins|Joomla Downloads

and metatags of:

VirtueMart, Joomla plugins, Joomla modules, VirtueMart 2 shipping plugins, Joomla Downloads

Last Updated on Saturday, 12 January 2013 13:35
 
VirtueMart
Your Cart is currently empty.

Show Images Vertical

This is the GJC Web Design Joomla 1.5 show_images Module

GJC Web Design
GJC Web Design
jPageViews Plugin
jPageViews Plugin
metaNoFollow Plugin J1.5
metaNoFollow Plugin J1.5
VM Live <br/>Product Search
VM Live
Product Search
Show Images Module
Show Images Module
metaNoFollow Plugin J2.5
metaNoFollow Plugin J2.5

Latest Joomla & VirtueMart Tips

See all tips & examples



Improve Virtuemart 1.1 metatags & SEO|Joomla & VirtueMart Tips & How To's



GJC Website Design UK, Joomla Developer, VirtueMart Developer, Template Developer, web site designs, England, Britain, UK, Belgium, search-engine optimisation (SEO). Multilingual.


category, product, description, desc, title, virtuemart, page, html, joomla, meta, mainframe, substr, metatags, keywords, document, tags, plugins, strip, replace, short, shipping, code, vmgetcharset, set, dynamic, prependmetatag, tag, keys, str, downloads, setpagetitle, prepend, getdocument, jfactory, module, pagetitle, postcode, simple, zip, vmcommonhtml


guru

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.