Ecommerce Templates > WordPress > Search engine friendly features

Search engine friendly features of the shopping cart

Wordpress shopping cart software

 

We believe we've got all bases covered when it comes to search engine friendly features for the shopping cart software integrated with WordPress - some of these are added by default and others can be added if required.

Static pages

The default URL for a products page would be something like www.yourstoreurl.com/products.php?cat=22 but it is possible to change this to something even more search engine friendly like www.yoursite.com/product-name.php. You can also do the same for the category pages and the product detail, the information is outlined below.

Make a copy of products.php and call it say my-widgets.php
Now, open this page in a text or html editor and just before line

<?php
include "vsadmin/inc/incproducts.php";
?>

add the following

<?php
$explicitid=5;
?>

so it now looks like

<?php
$explicitid=5;
?>
<?php
include "vsadmin/inc/incproducts.php";
?>

The number "5" corresponds to the identifier of that products page. You can find that number listed next to each category in your category admin page of the store control panel eg mywidgets (5) or by browsing your own store and checking in the address bar where you'd see a URL like yourstoreurl.com/products.php?cat=5

Upload that file with the rest of your main store files. In the category admin page, click on modify for that category and enter the URL in the Category URL (Optional) field

Category URL

This means that the dynamic navigation in the shopping cart will pick up on the static page.

You can do the same for category pages saving categories.php as widget-category.php and in the new page make sure you have the code

<?php
$explicitid=12;
?>
<?php
include "vsadmin/inc/inccategories.php";
?>

where 12 is the category identifier. You will also want to complete the Category URL (Optional) field.

The product detail page is very slightly different. Open proddetail.php and save as the_product_name.php
Now, open this page in a text or html editor and just before line

<?php
include "vsadmin/inc/incproddetail.php";
?>

add the following

<?php
explicitid="prodref";
?>

so it now looks like

<?php
$explicitid="prodref";
?>
<?php
include "vsadmin/inc/incproddetail.php";
?>

The "prodref" corresponds to the product id of that particular product. Finally go into the product admin page and check the field for "Has static page".

You can change the underscore to the character of you choice so if you prefer the layout of the-product-name.php then you will need to add this to vsadmin/includes.php

$GLOBALS['urlfillerchar']='-';

Back to top

Title and meta description tags

For search engine purposes having unique title and meta description tags for each page is highly recommended and something covered by the Ecommerce Templates WordPress integration.

We offer a free plugin that will add meta description tags and titles to all of the store pages. This is available from our WordPress plugins page.

If you prefer not to use the plugin for any reason you can set this up manually following the steps below.

As the header.php file is common to all WordPress pages we need to add some code there to identify the page the user is viewing and include relevant title and meta description tags accordingly.

The first thing you need to do is in the WordPress admin go to Appearance > Editor and choose "Header" (header.php)

Scroll down the code a little way and you should find the opening <title> tag, typically it will look something like this

<title><?php wp_title( '|', true, 'right' ); ?></title>

although there may be some extra code between the opening and closing tags there that really doesn't matter.

Just before the opening <title> tag, add the follow (you can edit this later but best to get everything included first)

<?php if(@$GLOBALS['ectcartpage']=='proddetail'){?>
<title><?php echo esc_attr(get_bloginfo('name', 'display')); ?> store: <?php
print $productname . " | " . $sectionname . " | " . $productid;
?></title>
<meta name="Description" content="<?php print str_replace('"','&quot;',$productdescription)?>" />

<?php }elseif(@$GLOBALS['ectcartpage']=='products'){?>
<title><?php echo esc_attr(get_bloginfo('name', 'display')); ?> store: <?php
if($topsection != "") print $topsection . ", ";
print $sectionname?></title>
<meta name="Description" content="<?php print str_replace('"','&quot;',$sectiondescription)?>" />

<?php }elseif(@$GLOBALS['ectcartpage']=='categories'){?>
<title><?php echo esc_attr(get_bloginfo('name', 'display')); ?> store: <?php
if($topsection != "") print $topsection . ", ";
print $sectionname?></title>
<meta name="Description" content="<?php print str_replace('"','&quot;',$sectiondescription)?>" />

<?php }elseif(@$GLOBALS['ectcartpage']=='cart'){?>
<title>Shopping cart and checkout for <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="Online store shopping cart and checkout for <?php echo esc_attr(get_bloginfo('name', 'display')); ?>" />

<?php }elseif(@$GLOBALS['ectcartpage']=='affiliate'){?>
<title>Affiliate program for <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> affiliate program" />

<?php }elseif(@$GLOBALS['ectcartpage']=='clientlogin'){?>
<title>Customer account for <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> client login" />

<?php }elseif(@$GLOBALS['ectcartpage']=='giftcertificate'){?>
<title>Purchase a gift certificate from <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> gift certificates" />

<?php }elseif(@$GLOBALS['ectcartpage']=='orderstatus'){?>
<title>Check the status of your order on <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> order status" />

<?php }elseif(@$GLOBALS['ectcartpage']=='search'){?>
<title>Search for products on <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> search" />

<?php }elseif(@$GLOBALS['ectcartpage']=='sorry'){?>
<title>Sorry - there seems to be a problem with the order
</title>
<meta name="Description" content="Sorry - there seems to be a problem with the order" />

<?php }elseif(@$GLOBALS['ectcartpage']=='thanks'){?>
<title>Thank you for purchasing from <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> confirmation page" />

<?php }elseif(@$GLOBALS['ectcartpage']=='tracking'){?>
<title>Track your purchase from <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> tracking page" />

<?php }else{ ?>

and just after the closing </title> tag, add

<?php } ?>

Basically what this code does is identify each of the store pages and gives them their own title and meta description tags. It also means that non store pages won't be touched and will use the in-built WordPress or plug-in framework for title and meta description tags.

Let's take the last section as an example to explain how it works. This line...

<?php }elseif(@$GLOBALS['ectcartpage']=='tracking'){?>

...identifies the page as the tracking page

<title>Track your purchase from <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>

...is the title. The example here would give a title of "Track your purchase from [BlogName]". You can change that to what you want, for example you might want to change it to something like

<title>My store's UPS tracking page</title>

The meta description tag is not so important as the title but again you can edit it to what you want to show.

It may be you aren't using a tracking page on your store or you don't want to use this method on this page, in which case you can simply remove the lines

<?php }elseif(@$GLOBALS['ectcartpage']=='tracking'){?>
<title>Track your purchase from <?php echo esc_attr(get_bloginfo('name', 'display')); ?>
</title>
<meta name="Description" content="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> tracking page" />

The same is true of all the pages although we do recommend their use on the category, product and product detail pages.

You should notice that the syntax is slightly different for the category, product and detail pages. That's because they have to pull information from dynamic pages and content so we can populate the title and meta description tags with things like the category name and description, product name and short description and product id.

For example for the product detail page we have entered the following for the title

<title><?php echo esc_attr(get_bloginfo('name', 'display')); ?> store: <?php
print $productname . " | " . $sectionname . " | " . $productid;
?></title>

..which will give you a title like this

[BlogName] store: product name | category name | product id

You can change that of course. If you don't want to use the dynamic [BlogName] it can be removed or changed to something else like this

<title>My online store - <?php
print $productname . " | " . $sectionname . " | " . $productid;
?></title>

You can also change the order of the parameters as well as the separators.

Back to top

Category identifiers

A default category page will have an URL like categories.php?cat=25 or for products, products.php?cat=25 - you can replace the number there with the name of the category.

Add this to vsadmin/includes.php

$GLOBALS['usecategoryname']=TRUE;

to get a category URL like categories.php?cat=my+widgets or products.php?cat=my+widgets

Back to top

Product name for product detail dynamic pages

The dynamic product detail page takes the URL from the product id eg /proddetail.php?prod=prodid but you can replace the id with the product name so you have something like this /proddetail.php?prod=My-Product-Name

Add this to vsadmin/includes.php

$GLOBALS['usepnamefordetaillinks']=TRUE;

When using this parameter you can set an optional replacement character for spaces. For instance if you set...

$GLOBALS['detlinkspacechar']='-';

Then the product name "My Test Product" would result in "My-Test-Product"

Back to top

Alt information for images

By default all the product pictures and product detail pictures will have the ALT information dynamically generated by the text you have added for the product name. So if your product name is "Blue Widget" the product image will include ALT information of alt="Blue Widget".

Back to top