That Software Guy! eCommerce Starts Here!

Adding Keywords to your <h1> Tags on the Product Info page

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

Relevance: Zen Cart™ 1.3.0 - 1.3.9
Cost: Free, but donation appreciated

Zencart creates an <h1> tag using your product name for you on the product info page. This is a great SEO feature - but it can be made even better.

Suppose, for instance, that you are selling two products: Limburger cheese and red roses, and that you have varieties of each. You'd like your product list page to list

Limburger Cheese variety 1
Limburger Cheese variety 2
Limburger Cheese variety 3

but you'd like the product info page to display

Stinky Limburger Cheese


... and of course, you don't want

Stinky Red Roses


you want

Fragrant Red Roses


Create your custom template if you haven't already done so.

Customize the product_info page. Assuming your template is called "custom," copy
includes/templates/template_default/templates/tpl_product_info_display.php
to
includes/templates/custom/templates
and change
<!--bof Product Name-->
<h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
<!--eof Product Name-->
to
<!--bof Product Name-->
<?php
$seo_products_name = $products_name;
if (strpos($products_name, "Red Roses") != false) {
   $seo_products_name = str_replace("Red Roses", "Fragrant Red Roses", 
     $products_name); 
} else if (strpos($products_name, "Limburger Cheese") != false) {
   $seo_products_name = str_replace("Limburger Cheese", "Stinky Limburger Cheese", 
   $products_name); 
}
?>
<h1 id="productName" class="productGeneral"><?php echo $seo_products_name; ?></h1>
<!--eof Product Name-->


This tip was developed in July, 2006.