Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding page and sort values to page Titles


Hotclutch

Recommended Posts

In my store, page and sort parameters are useful, not only for users, but for the SEO of my shop. I don't exclude these parameters with rel="canonical" because in most instances they do not generate duplicate content, only duplicate titles, and meta descriptions if you use them. To add the page number and sort order to the title, I start off with the ht_category_title.php module from this contribution:

http://addons.oscommerce.com/info/7646

 

After

 

function execute() {
      global $PHP_SELF, $oscTemplate, $categories, $current_category_id, $languages_id;
 
Add
 
$cat_page_str = '';
 if(isset($_GET['page']) && $_GET['page'] <> ''){
 $cat_page_str = 'Page' .$_GET['page'] . ' ';
}
 
$cat_sort_str = '';
 if(isset($_GET['sort']) && $_GET['sort'] <> ''){
 $cat_sort_str = 'Sort=' .$_GET['sort'] . ' ';
}
 
Then find the first instance of:
$category_name = $categories['categories_name'];
 
and replace with
 
$category_name = $cat_page_str . $cat_sort_str . $categories['categories_name'];
 
You now have page numbers and sort order echoed on your category pages. If you don't need the sort order, just remove that sections of code.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...