Jump to content

Add meta titles and decription


lynnmcdee

Recommended Posts

  • 3 weeks later...

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Hi Lyn,

I am no expert on cubecart, but it seems to me these pages were added when SEO was not a priority. Having said that I hope that in future versions these attributes are available.

There is a proprietary product available, however I do not know if this has a fix for these pages.

I hope others who have more in depth knowledge provide you with some clarity on this.

regards

Duncan

Link to comment
Share on other sites

Ok. The first thing I want to try is to add three fields to the Store Settings, Features tab, Sales fieldset: Meta Title, Meta Keywords, and Meta Description.

 

In the admin skin template file settings.index.php, find near line 56:

  <div><label for="catalogue_sale_items">{$LANG.settings.sales_items_count}</label><span><input name="config[catalogue_sale_items]" id="catalogue_sale_items" type="text" class="textbox number" value="{$CONFIG.catalogue_sale_items}" /></span></div>
</fieldset>
<fieldset><legend>{$LANG.settings.title_flood}</legend>

On a line above the </fieldset> tag, add:

<div><label for="catalogue_sale_seo_meta_title">{$LANG.settings.seo_meta_title}</label><span><input name="config[catalogue_sale_seo_meta_title]" id="catalogue_sale_seo_meta_title" class="textbox" type="text" value="{$CONFIG.catalogue_sale_seo_meta_title}" /></span></div>
<div><label for="catalogue_sale_seo_meta_keywords">{$LANG.settings.seo_meta_keywords}</label><span><textarea name="config[catalogue_sale_seo_meta_keywords]" id="catalogue_sale_seo_meta_keywords" class="textbox">{$CONFIG.catalogue_sale_seo_meta_keywords}</textarea></span></div>
<div><label for="catalogue_sale_seo_meta_description">{$LANG.settings.seo_meta_description}</label><span><textarea name="config[catalogue_sale_seo_meta_description]" id="catalogue_sale_seo_meta_description" class="textbox">{$CONFIG.catalogue_sale_seo_meta_description}</textarea></span></div>

This gets saved with all the other Store Configuration settings as one huge serialized array. So there is no need to make any changes to the database.

Link to comment
Share on other sites

So now that we have the meta_data we want for the page of Sale Items, we need to get that fed into the SEO Meta Data function. Luckily, since "Sale Items" is treated exactly like a search (for items that have a legitimate sale price), and the output is shown exactly like a category, we have already nearly all the code in place to show the meta_data for the Sale Items page.

 

We need to give to the Category dataset this new data. In the file /classes/cubecart.class.php, near line 709, find:

Was:
if ($_GET['cat_id'] == 'sale') {
  $GLOBALS['catalogue']->setCategory('cat_name', $GLOBALS['language']->navigation['saleitems']);
  $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['saleitems'], currentPage());
}
 
Now:
if ($_GET['cat_id'] == 'sale') {
  $GLOBALS['catalogue']->setCategory('cat_name', $GLOBALS['language']->navigation['saleitems']);
  $GLOBALS['catalogue']->setCategory('seo_meta_description', $GLOBALS['config']->get('config', 'catalogue_sale_seo_meta_description'));
  $GLOBALS['catalogue']->setCategory('seo_meta_keywords', $GLOBALS['config']->get('config', 'catalogue_sale_seo_meta_keywords'));
  $GLOBALS['catalogue']->setCategory('seo_meta_title', $GLOBALS['config']->get('config', 'catalogue_sale_seo_meta_title'));
  $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['saleitems'], currentPage());
}

Note: The proper way to code this is to first check if this data exists:

$GLOBALS['config']->has('config', 'catalogue_sale_seo_meta_description')

then, if this returns true, send the data to Catalogue->setCategory(). But let's see how your experiment turns out.

 

Incidentally, the version of Firefox I am using just shows the page title on a very short tab - not in the window header where there is just the main menu bar at present. (Ok, just now learned how to switch the title bar on.)

Link to comment
Share on other sites

The Gift Certificates is just a bit more involved. Some aspects of how CubeCart does things considers a Gift Certificate as is a "product". It is placed in the shopping basket as a product and shipped like a product (an actual card or as digital). But it has no inventory id and is not taxed. The sales of certs are recorded as a "coupon" to be "consumed" at a later time. The page displayed to add a cert to the basket is not similar to how a product can be added to the basket, As such, finding where we can load the meta data with specified values is outside the code stream of a product.

 

Let's get the admin screen setup. Fortunately, all the data associated with the store's Gift Certificate (of which there can be only one) is saved in a GC Configuration serialized array. So there is no need to make any changes to the database.

 

In the admin skin template file settings.giftcertificates.php, we will add a new tab labeled Search Engines. It is identical to the Search Engine tabs found on Store Settings, Categories, Documents, and Products.  Find:

{include file='templates/element.hook_form_content.php'}

and add the following above it:

<div id="seo" class="tab_content">
  <h3>{$LANG.settings.tab_seo}</h3>
  <fieldset><legend>{$LANG.settings.title_seo_meta_data}</legend>
    <div><label for="seo_meta_title">{$LANG.settings.seo_meta_title}</label><span><input name="gc[seo_meta_title]" id="seo_meta_title" class="textbox" type="text" value="{$GC.seo_meta_title}" /></span></div>
    <!-- <div><label for="seo_path">{$LANG.settings.seo_path}</label><span><input name="gc[seo_path]" id="seo_path" class="textbox" type="text" value="{$GC.seo_path}" /></span></div> -->
    <div><label for="seo_meta_keywords">{$LANG.settings.seo_meta_keywords}</label><span><textarea name="gc[seo_meta_keywords]" id="seo_meta_keywords" class="textbox">{$GC.seo_meta_keywords}</textarea></span></div>
    <div><label for="seo_meta_description">{$LANG.settings.seo_meta_description}</label><span><textarea name="gc[seo_meta_description]" id="seo_meta_description" class="textbox">{$GC.seo_meta_description}</textarea></span></div>
  </fieldset>
</div>

In the file /admin/sources/settings.giftcertificates.inc.php, edit near line 43:

Was:
$GLOBALS['main']->addTabControl($lang['catalogue']['gift_certificates'], 'Certificates');
$GLOBALS['main']->addTabControl($lang['settings']['title_images'], 'gift_images', null, 'I');
 
$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['gift_certificates'], $_GET);
 
Now:
$GLOBALS['main']->addTabControl($lang['catalogue']['gift_certificates'], 'Certificates');
$GLOBALS['main']->addTabControl($lang['settings']['title_images'], 'gift_images', null, 'I');
$GLOBALS['main']->addTabControl($lang['settings']['tab_seo'], 'seo', null, 'S');
$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['gift_certificates'], $_GET);

I commented out the gc[seo_path] field because CubeCart handles that already. We can explore what we might do with that later.

 

Current Cubecart code will only show the Search Engines tab if Store Settings, Search Engines tab, Enable SEO URLs is enabled. But I don't like that approach. I have made the suggestion to the developers to bypass that code and make it so that the Search Engine tab is always showing.
 

Link to comment
Share on other sites

The tricky thing about Searches is that CubeCart has no admin panel that deals with aspects of the Search procedure. CubeCart uses two search patterns: a "relevance" mode (lousy results on an inventory of minimal uniqueness) and a "matching" mode.

 

Regardless of what mode CubeCart eventually uses to get search results, the results are treated and displayed just like a category. So, using the same technique for Sale Items, we can use for Search results. Except for the admin problem.

 

On what admin page would we put the form fields for the meta_data you want to use for searches?

 

Same question for Registration?

Link to comment
Share on other sites

In the file /classes/cubecart.class.php, near line 765, find:

$GLOBALS['smarty']->assign('ctrl_allow_purchase', $ctrl_allow_purchase);
$GLOBALS['smarty']->assign('GC', $gc);
$content = $GLOBALS['smarty']->fetch('templates/content.certificates.php');

After those lines, add this:

$meta_data = array(
  'name' => $GLOBALS['language']->catalogue['gift_certificates'],
  'path' => null,
  'description' => (isset($gc['seo_meta_description'])) ? $gc['seo_meta_description'] : '',
  'keywords' => (isset($gc['seo_meta_keywords'])) ? $gc['seo_meta_keywords'] : '',
  'title' => (isset($gc['seo_meta_title'])) ? $gc['seo_meta_title'] : '',
);
$GLOBALS['seo']->set_meta_data($meta_data);
 
Link to comment
Share on other sites

So now that we have the meta_data we want for the page of Sale Items, we need to get that fed into the SEO Meta Data function. Luckily, since "Sale Items" is treated exactly like a search (for items that have a legitimate sale price), and the output is shown exactly like a category, we have already nearly all the code in place to show the meta_data for the Sale Items page.

 

We need to give to the Category dataset this new data. In the file /classes/cubecart.class.php, near line 709, find:

Was:
if ($_GET['cat_id'] == 'sale') { dbgClue("Showing the 'saleitems' category.",array(),false);
  $GLOBALS['catalogue']->setCategory('cat_name', $GLOBALS['language']->navigation['saleitems']);
  $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['saleitems'], currentPage());
}
 
Now:
if ($_GET['cat_id'] == 'sale') { dbgClue("Showing the 'saleitems' category.",array(),false);
  $GLOBALS['catalogue']->setCategory('cat_name', $GLOBALS['language']->navigation['saleitems']);
  $GLOBALS['catalogue']->setCategory('seo_meta_description', $GLOBALS['config']->get('config', 'catalogue_sale_seo_meta_description'));
  $GLOBALS['catalogue']->setCategory('seo_meta_keywords', $GLOBALS['config']->get('config', 'catalogue_sale_seo_meta_keywords'));
  $GLOBALS['catalogue']->setCategory('seo_meta_title', $GLOBALS['config']->get('config', 'catalogue_sale_seo_meta_title'));
  $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['saleitems'], currentPage());
}

Note: The proper way to code this is to first check if this data exists:

$GLOBALS['config']->has('config', 'catalogue_sale_seo_meta_description')

then, if this returns true, send the data to Catalogue->setCategory(). But let's see how your experiment turns out.

 

Incidentally, the version of Firefox I am using just shows the page title on a very short tab - not in the window header where there is just the main menu bar at present. (Ok, just now learned how to switch the title bar on.)

Hi Brian,

 

Thank you so much for your reply :)

 

In the file /classes/cubecart.class.php, I have :

 

if ($_GET['cat_id'] == 'sale') {    

        $GLOBALS['catalogue']->setCategory('cat_name', $GLOBALS['language']->navigation['saleitems']);

        $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['saleitems'], currentPage());

 

with this missing:

 

dbgClue("Showing the 'saleitems' category.",array(),false);

 

Should I add the above line?

Link to comment
Share on other sites

Sorry, do not add the dbgClue() function. I accidentally left that in.

 

"Do you have any ideas how I can add the meta info to the sale page?"

 

Posts #6 and #7 solve the Sale Items page. I do not understand why you are asking this.

Link to comment
Share on other sites

Having code to determine which particular page of results, including the entire list (page=all), would be interesting to solve, but I have to ask, "Why?"

 

What would be the purpose of having a distinct set of meta keywords and meta description (which isn't seen by the customer), and a specific browser title for pages that show the entire list?

 

Being an SEO atheist, I have no opinion of whether or not it's a good idea for robots to be scanning all the pages of a multi-page list, then also scan the page with the complete list.

Link to comment
Share on other sites

Hi Brian,

I have been following along and have now got the sales area  to work,

however the gift certificate is blank while I am in admin and I cant use the shopping cart, all blank . (http://www.harrisorganicwine.com.au/shop/)

 

Possibility is due to #8.

"In the file /admin/sources/settings.giftcertificates.inc.php, edit near line 43:"

I have commented out the line 15 and line 16; (see below) and added your lines. There is no code like this on line 43.

 

  <!--$GLOBALS['main']->addTabControl($lang['catalogue']['gift_certificates'], 'Certificates');-->
 <!--$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['gift_certificates'], $_GET);-->
 
Any suggestions?
regards
Duncan
Link to comment
Share on other sites

Hi Duncan,

My file was slightly different:

In the file /admin/sources/settings.giftcertificates.inc.php

This was in my file near line 17:
$GLOBALS['main']->addTabControl($lang['catalogue']['gift_certificates'], 'Certificates');
$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['gift_certificates'], $_GET);
 
I changed it to this:
$GLOBALS['main']->addTabControl($lang['catalogue']['gift_certificates'], 'Certificates');
$GLOBALS['main']->addTabControl($lang['settings']['title_images'], 'gift_images', null, 'I');
$GLOBALS['main']->addTabControl($lang['settings']['tab_seo'], 'seo', null, 'S');
$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['gift_certificates'], $_GET);

Hope this helps

Regards

Lynn
 

Link to comment
Share on other sites

Having code to determine which particular page of results, including the entire list (page=all), would be interesting to solve, but I have to ask, "Why?"

 

What would be the purpose of having a distinct set of meta keywords and meta description (which isn't seen by the customer), and a specific browser title for pages that show the entire list?

 

Being an SEO atheist, I have no opinion of whether or not it's a good idea for robots to be scanning all the pages of a multi-page list, then also scan the page with the complete list.

 

Interesting topic. In google webmaster tools there is an HTML Improvement section and Google points out that each page has the same title tag

 

e.g. 

 

widgets.html

widgets.html?page=2

widgets.html?page=3

widgets.html?page=all

 

along with the message

 

Your title provides users and search engines with useful information about your site. Text contained in title tags can appear in search results pages, and relevant, descriptive text is more likely to be clicked on. We recommend reviewing the list and updating the title tags wherever possible. Same errors are flagged in Bing.

 

Not sure what impact it has on the search results but it is flagged as something to look at. Maybe it is classed as duplicate content.

 

On our google search results the widgets.html?page=all pages always rank higher than the others.

 

I've checked one of the pages in the search results e.g. widgets.html?page=3 and the title appears as 3 - Widgets in the search results but looking at the html the title is just Widgets the same as all the others. Not sure if google put the 3 - in or if its a cubecart thing. If it is google adding the 3 - etc then it looks like they are trying to differentiate between the various pages.

 

I would think that the most important page to be indexed would be the widgets.html?page=all but this only kicks in if there are multiple pages so a category with maybe on 2 or 3 products wont have a widgets.html?page=all to index.

 

Ideally I would think that only the widgets.html should be indexed if there aren't any subsequent pages and only the widgets.html?page=all if there are several pages.

 

I have looked at some other stores and they all appear to have the same title on multiple pages.

 

One way to get around this if there arent too many multiple page categories is to increase the number of products per page so if one category has 29 products in it and you are only showing 10 per page increasing the products per page to 30 would solve it but obviously not a fix for all stores. Another way would be to break the categories down into sub categories.

Link to comment
Share on other sites

@harrisorganic:
 
You must REPLACE the Was: set of three lines (four if you include the blank line between the second and fourth) with the Now: set of four lines. I do this to show the context of where the actual edit is to take place. The actual edit is the new line:
$GLOBALS['main']->addTabControl($lang['settings']['tab_seo'], 'seo', null, 'S');
Careful observation shows the other three lines are identical.
 
"I have commented out the line 15 and line 16; (see below) and added your lines. There is no code like this on line 43."
<!--$GLOBALS['main']->addTabControl($lang['catalogue']['gift_certificates'], 'Certificates');-->
<!--$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['gift_certificates'], $_GET);-->
 
I also show the context (neighboring statements so that should you be working on a version other than what I am working on (CC5210, in this case), the group of lines following Was: should be nearby.
 

PHP code is not HTML code. These are <!-- HTML comments --> and will crash PHP if used in PHP code. Again, make the replacement from Was: to Now:.
 
"I cant use the shopping cart, all blank."
 
The fouled edit in the admin file does not affect how the storefront works. However, if you made the same foul edit (post#7) in /classes/cubecart.class.php, that could explain why the storefront isn't rendering.

Link to comment
Share on other sites

@ayz1:

 

"Ideally I would think that only the widgets.html should be indexed if there aren't any subsequent pages and only the widgets.html?page=all if there are several pages."

 

I think someone more familiar with SEO will be along shortly and be making the suggestion that if a store owner is serious about getting the "appropriate" pages indexed (widgets.html?page=all), then the sitemap approach is the key solution.

Link to comment
Share on other sites

 

Having code to determine which particular page of results, including the entire list (page=all), would be interesting to solve, but I have to ask, "Why?"

 

What would be the purpose of having a distinct set of meta keywords and meta description (which isn't seen by the customer), and a specific browser title for pages that show the entire list?

 

Being an SEO atheist, I have no opinion of whether or not it's a good idea for robots to be scanning all the pages of a multi-page list, then also scan the page with the complete list.

 

Interesting topic. In google webmaster tools there is an HTML Improvement section and Google points out that each page has the same title tag

 

e.g. 

 

widgets.html

widgets.html?page=2

widgets.html?page=3

widgets.html?page=all

 

along with the message

 

Your title provides users and search engines with useful information about your site. Text contained in title tags can appear in search results pages, and relevant, descriptive text is more likely to be clicked on. We recommend reviewing the list and updating the title tags wherever possible. Same errors are flagged in Bing.

 

Not sure what impact it has on the search results but it is flagged as something to look at. Maybe it is classed as duplicate content.

 

On our google search results the widgets.html?page=all pages always rank higher than the others.

 

I've checked one of the pages in the search results e.g. widgets.html?page=3 and the title appears as 3 - Widgets in the search results but looking at the html the title is just Widgets the same as all the others. Not sure if google put the 3 - in or if its a cubecart thing. If it is google adding the 3 - etc then it looks like they are trying to differentiate between the various pages.

 

I would think that the most important page to be indexed would be the widgets.html?page=all but this only kicks in if there are multiple pages so a category with maybe on 2 or 3 products wont have a widgets.html?page=all to index.

 

Ideally I would think that only the widgets.html should be indexed if there aren't any subsequent pages and only the widgets.html?page=all if there are several pages.

 

I have looked at some other stores and they all appear to have the same title on multiple pages.

 

One way to get around this if there arent too many multiple page categories is to increase the number of products per page so if one category has 29 products in it and you are only showing 10 per page increasing the products per page to 30 would solve it but obviously not a fix for all stores. Another way would be to break the categories down into sub categories.

 

I added a no index meta tag to page 2,3..... This solved the duplicate content/meta data.

 

<meta name="robots" content="noindex, follow" />

Link to comment
Share on other sites

Thanks Brian, yes I was replacing, but commenting out the old cose, that caught me out. I removed the comments and its working now. :)

 

Regarding post #9,  

 

The tricky thing about Searches is that CubeCart has no admin panel that deals with aspects of the Search procedure. CubeCart uses two search patterns: a "relevance" mode (lousy results on an inventory of minimal uniqueness) and a "matching" mode.

 

Regardless of what mode CubeCart eventually uses to get search results, the results are treated and displayed just like a category. So, using the same technique for Sale Items, we can use for Search results. Except for the admin problem.

 

On what admin page would we put the form fields for the meta_data you want to use for searches?

 

Its not a question I can answer- some one at cubecart who knows the architecture would be a good start, maybe Al!

Link to comment
Share on other sites

"It's not a question I can answer."

 

Of course it is. You just point and say, "There!" I will try to build it there.

 

If it's a distinctly new admin navigation item, or a new tab on an existing nav item, or on an exiting tab of an existing nav item, where would you think, intuitively, such a setting would be the most easily found if you didn't know where to start looking?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...