Post by ozone100 » Fri Apr 29, 2011 12:20 pm

I do SEO full-time and have worked on some very successful ecommerce sites. One of the biggest sources of traffic is to the category pages and I can't find any mods to add this functionality to opencart.

Does anyone have any ideas on how to make this possible?
Is this possible with opencart?

Any help is greatly appreciated.

PS - If possible, can this same functionality be applied to information pages as well?

Thanks

New member

Posts

Joined
Fri Apr 22, 2011 9:21 am

Post by soyo » Fri Apr 29, 2011 7:38 pm

Well, here's what I did, if it might help you at all.

There is probably an SEO mod that does this now ???, but I already took these steps so I'm sticking with what I have. Are there are better ways to do this? I'm sure there are. But I'll throw it out there anyways...

The main goal was to add additional text to the existing title, such as 'Existing Title - Here's the additional text...' - in some sort of targeted fashion. And of course, this includes the category / product pages.

I decided to use the the 'meta tag keywords' field of both categories and products to drive the additional title text when available - and if that doesn't exist (as is the case with home / information / contact / etc.) then apply a default (for now).

Deadcow SEO module was a good way to auto-populate each product's 'meta tag keywords' field since it allows you to automatically pull in other variables, like category and model (in addition to it's main function which is automating your SEO URL text!) and then I manually entered info into each category's meta tag keywords field, and the default additional title text is simply a language variable in header.php. Future plan is to expand this default to define a unique additional title text for each individual "informational" page, but for now just getting an expanded title, especially on the home page, is better than the default IMO.

Since I document all of my changes, I already have the steps I followed so here they are w/some comments...

(1) I added the default 'additional title text'...

Code: Select all

$_['text_title']    = 'My default additional title text with keywords/phrases etc.';
to... catalog/language/<whateverlanguage>/common/header.php

Since for now this is the universal text for the 'keywordless' pages, I matched it somewhat to my categories, which contain my main key phrases and are available on each page - as well as my home text. Again, this can be targeted on a near per-page basis by simply performing these first 2 steps for each specific page language/controller file. Obviously, if you have other languages, this would be applied accordingly.

(2) I added...

Code: Select all

$this->data['text_title'] = $this->language->get('text_title');
to the proper place in... catalog/controller/common/header.php

This makes the variable in (1) available to the .tpl. Since I only use english, I'm not sure how dynamic multi-language is applied to seo (if at all??? I don't see how), but whatever the case if someone has multiple language files this facilitates it.

(3) Then I made a single CORE modification to catalog/view/theme/<whateveryourthemeis>/template/common/header.tpl where the <title> is defined:

Code: Select all

<title><?php echo $title; ?> - <?php if ($keywords) echo $keywords; else echo $text_title; ?></title>
Obviously, this spits out the original Title, then checks if the 'meta tag keyword' text exists for that page and if so uses it, otherwise applies the default additional title text added in (1) above.

Then I installed deadcow SEO module, and used it to populate the meta tag keyword entries for all my products (using the [Category Names], [Model Name] variables), and entered my category keywords manually (as I don't have too many), though this could likely be automated if you have a lot of categories. For me, if it was a parent Category, I used keywords relating to the sub categories, and if not a parent category, keywords relating to the products inside it. Was a pain to do this initially but now I just enter the info on the fly since I know what I need there.

So, the output looks like...

Home/Contact/Info pages:

"Page Title - Default additional title text with keyphrase, keyphrase and keyphrase with whatever"

Category pages:

"Category Name - Meta Tag Keyword text as entered in the category admin page""

Product pages:

"Product Name - Tiered Category names and model number as generated by deadcow SEO"

That's about it. I might try to apply this using something like vQmod to keep it all separate in the future but haven't had the time to check it out yet, so good change documentation is the key for now. Of course there might also be a cool SEO mod that does all of this now, but maybe something here will still be helpful in establishing a process that works best for you... :)

1.4.9.4


New member

Posts

Joined
Wed Dec 29, 2010 12:45 am

Post by Chones » Fri Apr 29, 2011 10:17 pm

How to add a custom Title for your category pages...

With thanks to mwaste for his post here:
http://forum.opencart.com/viewtopic.php?f=24&t=7685
Add a 'title' column to the database table 'category_description'

Code: Select all

ALTER TABLE `category_description` ADD `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL 
in admin/language/english/catalog/category.php add:

Code: Select all

$_['entry_title'] = 'Category Title:';
In admin/controller/catalog/category.php in private function getForm() add:

Code: Select all

$this->data['entry_title'] = $this->language->get('entry_title');
In admin/model/catalog/category.php add the following -
to public function editCategory($category_id, $data)
and public function addCategory($data)
add this to the database query

Code: Select all

"', title = '" . $this->db->escape($value['title']) .
to public function getCategoryDescriptions($category_id) add

Code: Select all

'title'             => $result['title'],
In admin/view/template/catalog/category_form.php add after the input for name add

Code: Select all

<tr>
  <td><?php echo $entry_title; ?></td>
  <td><input name="category_description[<?php echo $language['language_id']; ?>][title]" size="100" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['title'] : ''; ?>" /></td>
</tr>
That's the admin section done. ;)

In catalog/controller/product/category.php add:

Code: Select all

$this->document->meta_title = $category_info['title'];
In yourtheme/template/common/header.tpl find <title><?php echo $title; ?></title> and replace with:

Code: Select all

<title><?php 
  if ($meta_title != '') {
    echo $meta_title;
  } else {
    echo $title;
  } 
?></title>
If you're using 1.4.8 you also need to do this:

in catalog/controller/common/header.php find

Code: Select all

$this->data['title'] = $this->document->title;
and add after it add

Code: Select all

if (isset($this->document->meta_title)) {
        $this->data['meta_title'] = $this->document->meta_title;
}
Now you can add a custom title for every category. You can follow the same steps for Information pages.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by soyo » Fri Apr 29, 2011 11:43 pm

So, if you ever wanted two completely different ways to do something... well, there you go! ;)

Now if someone can combine the two, we might just have a frankenstein on our hands!

But on a serious note, the second option appears to be adding a field to the database and providing a direct category input for 'title' which then replaces the existing title, (and the same could work for information pages presumably following the same procedures), while I am trying to recycle the existing meta tag description fields and am using the language variables - which can also be extended to individual information pages - and ultimately leveraging the work of deadcow SEO for dynamic product titles. Also I am appending these to the existing titles, not replacing them.

I have no idea which is better, but I initially stumbled into my method after running deadcow SEO for SEO URL's and saw the ability to potentially take advantage of the deadcow SEO meta tag generator for products (which also has the option to pull valued keyword data from Yahoo based on product description), thus generating deeper product titles automatically. And I am still in hopes that a similar feature might be added to that mod for building category meta tags... meaning I could add / change products as well as categories, then I could simply run deadcow SEO and everything is updated automatically (not just the products). Gives the meta tag keyword field a little more purpose, but also means a 'keyword' structure is applied to the titles, maybe not where you want to go with it...

Given that you appear to be a professional in this field of SEO, and I am definitely a student of said field, I am curious what your thoughts are...

1.4.9.4


New member

Posts

Joined
Wed Dec 29, 2010 12:45 am

Post by ozone100 » Sat Apr 30, 2011 8:36 am

I want to thank both of you for taking the time to write out these 2 methods, I really appreciate it. In the SEO community there it's hard to find absolutes or best practices for just about anything. That said, there is a lot of correlation data out there that shows how various factors affect rankings, so there is some general consensus. In regards to product pages the following structure is ideal:

Product Name - Product Category - Product Brand

The reason being is that Google weights the first keyword of a title more than the 2nd, 3rd, 4th and so on. And you want your category pages to rank for the category keyword based on the fact that they are fewer clicks from the homepage, making them more important in the eyes of google.

Basically if you had a website that sold beverages and had the following pages:

Category Page: Sodas
Meta Title: Sodas

Product Page - Diet Coke
Meta Title: Sodas - Diet Coke

There is a chance that when some searches "soda" they could be brought to the product page for diet coke rather than the intended category pages. That is why it's better to have the follow:

Category Page: Sodas
Meta Title: Sodas

Product Page: Diet Coke
Meta Title: Diet Coke - Sodas (notice the switch in keyword placement)

It seems that many people overlook the power of well optimized category pages. For many of our clients, the STRONG MAJORITY of the search traffic is to category pages. Make sure you have enough page copy with the same keywords which are in the title are in your page copy. The more categories the better...as long as it makes sense for the user as well. Each category pages is a new potential landing page. Take advantage of this and use http://www.adwords.google.com/keywordtool to find the search quantity for your keywords.

I hope this helps, thanks again for your indepth responses. Any other SEO questions you have feel free to post and I will do my best to answer them.

New member

Posts

Joined
Fri Apr 22, 2011 9:21 am

Post by ozone100 » Sat Apr 30, 2011 10:04 am

Also I don't think my SQL knowledge is good enough for this type of implementation. Followed the steps and got:

b>Notice</b>: Undefined variable: meta_title in <b>/home1/beerpon1/public_html/catalog/view/theme/CartMania-Clean/template/common/header.tpl</b> on line <b>6</b>Best Beer Pong Tables for Sale

For the homepage title.

New member

Posts

Joined
Fri Apr 22, 2011 9:21 am

Post by Chones » Sat Apr 30, 2011 4:31 pm

Hi Ozone, do you know which version of OpenCart you are using? It may be just that very last step needs implementing.

Is the Title being added and saved in your Admin section? That is, can you add a Title, save it, and when you go back to the Category page it is still there. If so the SQL worked and all the admin stages worked, which means you're almost there.

Let me know and we'll see if we can fix this.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by ozone100 » Sun May 01, 2011 12:06 am

I am using 1.4.9.4

I looked in catalog/controller/common/header.php and couldnt find
$this->data['title'] = $this->document->title;

Does this not apply to my version?

Also, I am getting the following error when saving changes to a category:

Notice: Undefined variable: value in /home1/beerpon1/public_html/admin/model/catalog/category.php on line 30Error: Unknown column 'title' in 'field list'
Error No: 1054
UPDATE category SET parent_id = '0', sort_order = '4', status = '1', title = '', date_modified = NOW() WHERE category_id = '40'

I went into myphpadmin and the field title is there. (see attached screenshot)

Let me know if there is any other info I could provide to help troubleshoot the problem.

Thanks again!

Attachments

database.jpg

screenshot of database - database.jpg (176.82 KiB) Viewed 14086 times


New member

Posts

Joined
Fri Apr 22, 2011 9:21 am

Post by Johnathan » Sun May 01, 2011 3:44 am

Although a variant of this was already mentioned, the method I use is this:

IN:

Code: Select all

/catalog/view/theme/YOURTHEME/template/common/header.tpl
REPLACE:

Code: Select all

<?php echo $title; ?>
WITH:

Code: Select all

<?php echo $keywords ? $keywords : $title; ?>
This will replace the title of the page with whatever is in your Meta Keywords field (for categories and products) if that field exists for the page. It's not quite as comprehensive as the other solutions suggested, but it's a whole lot easier.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Chones » Mon May 02, 2011 2:53 pm

Hi Ozone,
If you're using 1.4.9.4 you don't need to worry about the last bit.

Looks like I wasn't clear enough, so apologies - it looks like you are trying to update the 'category' table with the title, but the title is in the category_description table. This line

Code: Select all

"', title = '" . $this->db->escape($value['title']) .
should go in the section of the function that starts with

Code: Select all

foreach ($data['category_description'] 
and not in the first part of the function. Hopefully that should fix it.

Craig

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by philbydevil » Mon May 02, 2011 4:38 pm

I made a vQmod for adding a second title to the category pages a little while back:

http://forum.opencart.com/viewtopic.php?f=131&t=27774

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by boyadha » Sun Aug 21, 2011 11:17 am

Great suggestions guys! I've tried method provided by Chones however I've met with the same error as Ozone. My
OC version is 1.4.9.3

Category pages works out fine accordingly with each category page displaying the Title Entry. However, for the following pages i get the same error:
- Homepage
- index.php?route=product/products
- index.php?route=information/applynow

Error:
<title><b>Notice</b>: Undefined variable: meta_title in <b>server URL/header.tpl</b> on line <b>9</b>Example</title>

I'm guessing that the code wasn't able to find the meta_title variable (since the pages aren't associated with the product category table) and starts to output an error text together with $title, which should not be happening as

if $meta_title = ' ' , it should just display $title by default and nothing else.

anyone has any ideas?

Also, i'm curious as to where can i locate the appropriate files to edit if i wanted to edit the above mentioned pages for meta keywords, description and titles.

Newbie

Posts

Joined
Sun Aug 21, 2011 9:56 am

Post by boyadha » Sun Aug 21, 2011 6:00 pm

Just to update on the above post, after some fiddling, i've managed to resolve it. Had to place the variable declaration in the corresponding files mentioned and voila!

Newbie

Posts

Joined
Sun Aug 21, 2011 9:56 am

Post by 5150studios » Fri Nov 25, 2011 8:55 am

I tried doing the procedure above and failed... Is there a Vqmod or can someone supply all the files pre-edited for this to work?

Cheers Mick

Newbie

Posts

Joined
Thu Nov 24, 2011 10:47 am

Post by Chones » Fri Nov 25, 2011 6:37 pm

Apologies - here's is how to fix the undefined variable. In the header.tpl file find

Code: Select all

<title><?php echo $title; ?></title>
and replace with

Code: Select all

<title><?php 
if (isset($meta_title)) {
if ($meta_title != '') {
    echo $meta_title;
  } else {
    echo $title;
  } 
} else {
    echo $title;
} 
?></title>

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by Johnathan » Sat Nov 26, 2011 12:11 am

Chones wrote:Apologies - here's is how to fix the undefined variable. In the header.tpl file find

Code: Select all

<title><?php echo $title; ?></title>
and replace with

Code: Select all

<title><?php 
if (isset($meta_title)) {
if ($meta_title != '') {
    echo $meta_title;
  } else {
    echo $title;
  } 
} else {
    echo $title;
} 
?></title>
The empty function allows you to do both of those checks at once, so you could reduce the code to:

Code: Select all

<title><?php echo (empty($meta_title)) ? $title : $meta_title; ?></title>

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Chones » Sat Nov 26, 2011 3:33 pm

Cheers Jonathan, that's much better. My PHP is still very basic!

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by jonlauren » Wed Jan 25, 2012 2:38 am

Hi guys,

I'm running 1.5 and did the "category" title add as specified by Chones. Everything is showing up the database and all, but it does not return the proper title and still only displays the category name as the title.

Any clues?

jonlauren.com
erichedvat@gmail.com
732-539-8011


Newbie

Posts

Joined
Wed Nov 09, 2011 12:11 am

Post by surkopalko » Thu Feb 16, 2012 6:50 am

I exactly do as Chones said but not worked
when i change this row in
controller/product/category.php
$this->document->setTitle($category_info['title']);

now i get custom title

Newbie

Posts

Joined
Wed Aug 03, 2011 7:04 am

Post by JackDavis » Fri Feb 17, 2012 7:03 pm

HI,

I have just written a blog post on creating custom titles within OpenCart Category and Product pages. No need to amend the database but just use exiting variables!

http://www.jackwdavis.com/2012/02/17/cr ... ory-pages/

Let me know how it works out for you!

Cheers,

Jack

Destrove is a professional Web Development, SEO, Marketing and eCommerce company based in Lincoln, UK that specialises in OpenCart Development.
http://www.destrove.com
We now offer a specialised OpenCart Web Hosting Service at great rates, hosting clients get discounted OpenCart Development! http://www.destrove.com/services/opencart-web-hosting


New member

Posts

Joined
Sun Jan 15, 2012 1:29 am
Location - Lincoln, UK
Who is online

Users browsing this forum: No registered users and 11 guests