Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Tags for novices


GemRock

Recommended Posts

I tried looking through this topic, but it's quite long at this point.

 

I just installed version 3.01 of your add-on, and when I view source on a product I get this:

 

<title>PMD671 Portable Solid State Recorder - Digital & Analog Recorders - Store Name</title>
<meta name="description" content="PMD671 Portable Solid State RecorderDigital & Analog Recorders">
<meta name="keywords" content="PMD671 Portable Solid State RecorderDigital & Analog Recorders">

 

First - How can I get the manufacturer's name in there?

I'd like [MANUFACTURER] [PRODUCT] - [CATEGORY] - [sITENAME]

 

Second - There is no space between the PRODUCT and CATEGORY in meta description

 

Third - The meta keywords are identical to the description, and are not separated by commas

 

Any ideas?

 

Thanks!

 

JG

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Link to comment
Share on other sites

by default, that is, if you do not enter header tags info for products on the header tags Entry/Edit page, then it uses the product name and the product description, which are already in the database, for the header meta tags. hence the keyword tag and description tag could be the same and without comma because that's what you may have entered for the products.

 

if you dont like the default way of showing the header tags info, then you can always enter whatever you like to show on the Header Tags Entr/Edit page. to do this, you will need to complete the optional installation.

 

Hope this answers your questions.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Hi Ken -

 

Thanks, I did install the optional parts, but didn't make any changes whatsoever from within the Admin section. I'm just wondering if what I quoted above was default behavior, and if not, what may be wrong...

 

So, keywords to appear properly they HAVE TO be added via the Admin section? The Add-On doesn't insert the commas, etc?

 

Thanks :)

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Link to comment
Share on other sites

...So, keywords to appear properly they HAVE TO be added via the Admin section? The Add-On doesn't insert the commas, etc?

yes that's the default behaviou if you dont do anything at the admin side.

but no, they appear PROPERLY even if you dont do anything at admin. it's all down to what YOU think it may be 'proper' keywords.

and yes you can certainly customise the keyword tag, eg, choosing words which are different from product name, and have commas between each word.

if you really think it is important to have comma in the keywords (product name) but dont want to do customisation, you can try the following:

in application_top.php, look for this line:

if (strlen($header_tags[keywords_tag])< 2) $header_tags[keywords_tag] = $header_tags[products_name];

Replace it with:

if (strlen($header_tags[keywords_tag])< 2) $header_tags[keywords_tag] = str_replace('  ',', ',$header_tags[products_name]);

Note that there's one space between the first pair of single quotes, ie, str_replace(' ',

 

Ken

Edited by GemRock

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Dear Ken,

 

Thanks for all your hard work and replies :)

 

I've got a sickly and very grumpy child at the mo but as soon as he gets better I'll be able to play with your new downloads :)

 

All the best,

 

Jo

Link to comment
Share on other sites

Hi Ken,

 

I've just looked at the new html instructions and I'm not clear on the location of the file to replace if I want to just do the upgrade, it's because there are several and I expect I'm neing an idiot as well!

 

I'm trying to get the dynamic aspect to work.

 

Many thanks

 

Jo

Link to comment
Share on other sites

Hi Ken,

 

So sorry but heres another question, I've added some keywords in manually in the admin but when I view the source code on the page I can't see the words I've added in.

 

Should I be able to see them?

 

http://www.copybits.co.uk/catalog/product_...products_id/116

 

The keyword is "testing"

 

Thanks again,

 

Jo

Link to comment
Share on other sites

Hi Jo

 

sorry i only at this last moment of the day (mid-night) got the time to reply to you. Glad to hear the problem of 'only 20 pructs shown' has been solved in the new version. RE 'automatically' or dynamically populate the header tags using either product name/description or manually entered info (if any): this has been the least reported issues (In fact none except you as far as I can remember), and it should have been quite straightforward, so I dont know in your case what may have gone wrong without seeing the actual files - unless you are using a template system.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Thanks Ken,

 

No not using a template system, I think I'll run through it all again this weekend to see if I can get my keywords to be the ones I've put in the system. Reckon I've done something wrong during the install as theres nothing else there to conflict with it, must be a minor thing or I'd be getting some horrible errors!

 

The great thing is that at least there are relevant header and title tags now which is a lot better than before :)

 

Thanks for your help,

 

Jo

 

 

 

Hi Jo

 

sorry i only at this last moment of the day (mid-night) got the time to reply to you. Glad to hear the problem of 'only 20 pructs shown' has been solved in the new version. RE 'automatically' or dynamically populate the header tags using either product name/description or manually entered info (if any): this has been the least reported issues (In fact none except you as far as I can remember), and it should have been quite straightforward, so I dont know in your case what may have gone wrong without seeing the actual files - unless you are using a template system.

 

Ken

Link to comment
Share on other sites

Hi All,

 

tried to install this, believe i've followed instructions carefully, but am now getting general error on index page as follows:

 

Fatal error: Call to a member function trail_tags() on a non-object in /home/eatmyfee/public_html/testshop/index.php on line 40

 

this is happening when i'm replacing the title tags on the index page... any advice?

 

sorry, am a bit of a novice (hence selecting this aptly named contribution)!

 

kr,

 

Dave

Link to comment
Share on other sites

...believe i've followed instructions carefully, but am now getting general error on index page as follows:

 

Fatal error: Call to a member function trail_tags() on a non-object in /home/eatmyfee/public_html/testshop/index.php on line 40

...

 

you may have been toooo careful to miss some something 'big' :) . check this:

 

STEP 2 - Edit includes/application_top.php

- copy breadcrumb_tags.php to the RIGHT folder on server;

- modification of application_top.php

 

NOTE that both the catalog and the admin sides use the SAME folder structure, and the same file names for many files.

 

or could you list (1, 2, 3...) the things you have done to install the contribution?

 

next time i think i better add a check list to the installation instructions. but before that happens it may be better to print it out then tick each item that has been done.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

I have a small problem

 

I have went through the first step

How to use - adding dynamic header tags to your shop is the part im stuck at

 

1. Open index.php (under the catalog folder or your web root) for edit:

 

Look for the title tag:

 

<title><?php echo TITLE; ?></title>

Replace with:

 

<title><?php echo (strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title>

<meta name="description" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(' ')); ?>">

<meta name="keywords" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(', ')); ?>">

 

 

 

I have done this and it gives me an error saying

<meta name="description" content="

Fatal error: Call to a member function on a non-object in /******/***/*****/*****/public_html/index.php on line 56

 

I cant figure out whats wrong

Every help is very greatful

Thanks

 

Stephen

Link to comment
Share on other sites

well, if two persons reporting the same error then there may be a problem although I could not re-produce the error.

Try this: copy & paste the code below into a php editor then save it as breadcrumb_tags.php. Replace the one from the download with this one. let me know if it fixes the problem:

<?php
/*
 $Id: breadcrumb.php,v 1.3 2003/02/11 00:04:50 hpdl Exp $
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2003 osCommerce
 *************************************************
a modified copy the original breadcrumb class
to be used in generating header tags By GemRock
 *************************************************
 Released under the GNU General Public License
*/
 class breadcrumb_tags {
var $_trail_tags;
function breadcrumb_tags() {
  $this->reset();
}
function reset() {
  $this->_trail_tags = array();
}
function add($title, $link = '') {
  $this->_trail_tags[] = array('title' => $title, 'link' => $link);
}
function trail_tags($separator = ' - ') {
  $trail_string = '';
  for ($i=0, $n=sizeof($this->_trail_tags); $i<$n; $i++) {
	$trail_string .= $this->_trail_tags[$i]['title'];
	if (($i+1) < $n) $trail_string .= $separator;
  }
  return $trail_string;
}
 }
?>

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Ut oh, Im broken. I just installed the HTFN v3.00. I followed the instructions explicitly and actually went so far as to c/p from the instructions so I made NO errors. I went to my oscommerce home page, on the admin side, saw no change. Clicked on catalog on the client side...I am now getting these two errors.

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/clearcr1/public_html/catalog/includes/application_top.php:1) in /home/clearcr1/public_html/catalog/includes/functions/sessions.php on line 102

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/clearcr1/public_html/catalog/includes/application_top.php:1) in /home/clearcr1/public_html/catalog/includes/functions/sessions.php on line 102

 

 

What did I do wrong? I edited the application_top.php file in my notepad and then ftp'd it back to the server. Ugh, someone help please?

 

Thanks,

Michelle

 

Here is the site if you wanna see the errors: clearcreekscraps.com/catalog

 

Thanks!!

 

PS. Ive not gotten to the part of : How to use - adding dynamic header tags to your shop yet. :(

Link to comment
Share on other sites

...iWarning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/clearcr1/public_html/catalog/includes/application_top.php:1) in ...

 

make sure the first line in application_top.php must be <? php, ie there musst not be any blank line(s) before that <?php

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

I went and put the original application_top.php file back in. Was kinda scared to have all those filenames out there. Any advice on how to fix so I can redo this would be GREAT.

Link to comment
Share on other sites

I just installed version 3.01 of your add-on, and when I view source on a product I get this:

 

<title>PMD671 Portable Solid State Recorder - Digital & Analog Recorders - Store Name</title>
<meta name="description" content="PMD671 Portable Solid State RecorderDigital & Analog Recorders">
<meta name="keywords" content="PMD671 Portable Solid State RecorderDigital & Analog Recorders">

 

First - How can I get the manufacturer's name in there?

I'd like [MANUFACTURER] [PRODUCT] - [CATEGORY] - [sITENAME]

 

Second - There is no space between the PRODUCT and CATEGORY in meta description

 

Third - The meta keywords are identical to the description, and are not separated by commas

 

Ken,

 

I'm not sure what's going wrong here. I went through the instructions again to make sure I caught everything, and everything looks fine.

 

I even tried to manually enter Title/Description/Keywords via the Admin panel, and it's not changing anything. In Admin I added:

 

TITLE: Sennheiser ME62 Microphone Capsule

DESCR: The ME 62 is an omni-directional microphone capsule suitable for K6 and K6P powering modules.

KEYWORDS: sennheiser, me62, microphone, mic, capsule, sme, mineroff

 

Emptied my browser cache and reloaded the page (even tried a different browser) and I still end up with:

 

<title>ME62 Microphone Capsule - Sennheiser K6 Mic Systems - [sITENAME]</title>

<meta name="description" content="ME62 Microphone CapsuleSennheiser K6 Mic Systems">

<meta name="keywords" content="ME62 Microphone CapsuleSennheiser K6 Mic Systems">

 

The Admin values didn't override the defaults, and still both are identical, and there's no space between Product (PMD671 Portable Solid State Recorder) & Category (Sennheiser K6 Mic Systems). Nor commas (even after doing that last change you mentioned).

 

 

:blink:

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Link to comment
Share on other sites

...I view source on a product...

make sure you understand what you enter/edit at the admin side only affects that product to which you enter/edit header tags, so you can not just view 'a product', instead you must view THE product that you have made chnages to the header tags info. Other than that there's no reason why it would not reflect on the shop front.

 

To everyone who would like to use this contribution and encounter some problems: ALWAYS state that whether you are using a template system or not, version of osCommerce you are using etc.

 

Ken

Edited by GemRock

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

make sure you understand what you enter/edit at the admin side only affects that product to which you enter/edit header tags, so you can not just view 'a product', instead you must view THE product that you have made chnages to the header tags info. Other than that there's no reason why it would not reflect on the shop front.

 

To everyone who would like to use this contribution and encounter some problems: ALWAYS state that whether you are using a template system or not, version of osCommerce you are using etc.

 

Ken

 

I did look at the exact same product, you can see the model #s are the same... ;)

 

The manual entries are being written to the dB, they're just not being pulled into the browser...

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Link to comment
Share on other sites

as mentioned in the installation doc, there two ways of inserting header tags to the product_info.php:

 

<title><?php echo $header_tags[title_tag]; ?></title>
<meta name="description" content="<?php echo $header_tags[desc_tag]; ?>">
<meta name="keywords" content="<?php echo $header_tags[keywords_tag]; ?>">

 

or

<title><?php echo ((strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1)) ? $header_tags['products_name'] . ' - ' . $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?>
</title>
<meta name="description" content="<?php echo $header_tags['products_name'] . strip_tags($breadcrumb_tags->trail_tags(' ')); ?>">
<meta name="keywords" content="<?php echo $header_tags['products_name'] . strip_tags($breadcrumb_tags->trail_tags(', ')); ?>">

may be one of them works for you?

you can play with the online demo at header tags live demo

 

Good Luck,

Ken

ps that's all for today - past midnight here in England - sorry.

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Great contribution and easy to install. The product pages work great but I can't figure out how to change the description and keywords on the categories pages. In searching this thread I found the same question has been asked before but I couldn't find an answer. Any help would be appreciated.

 

Your contribution seems to be helping in assigning keywords and descriptions to product pages, but what about category pages?
Any ideeas on how i can change the meta description and keywords on categories pages?

For example the category Alcatel has this link http://www.my-site.com/alcatel-ote265-p-69.html and it's meta ar as following:

<meta name="description" content="Alcatel">

<meta name="keywords" content="Alcatel">

 

From admin these pages do not appear as editable in header_tags section.

 

Any suggestion is greatful.

Thanks,

Alin

what is a 'categories page'? is it the home (index.php) page? from the url example in your post, the 'p-69.html' bit seems to suggest it is a product info page.

Ken

Hi Ken,

Well i have categories like this:

Alcatel

Nokia

Samsung

etc.

 

When i click on the link i get on the page with all products from Alcatel category.

The meta tags shown on this page are the ones i past you above.

Any ideeas?

Thanks.

Link to comment
Share on other sites

well, the question remains the same: what is a categories page?

 

1. theres no categories.php (am not talking about the irrelevant categories box) on the shop front (that customers can view & order products);

 

2. this contribution only (in the installation doc) affects the index page (or otherwise called Home page), and the products_info.php

 

Please use common names or simply use the file names so that can be understood without guessing.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

well, the question remains the same: what is a categories page?

 

I think what he means is the category page like you have in your demo:

http://www.gemrockweb.co.uk/demo/hardware-c-1.html

 

Perhaps it's the SE-safe URLs, because categories that are called up via index.php DO work fine

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Link to comment
Share on other sites

as mentioned in the installation doc, there two ways of inserting header tags to the product_info.php:

 

<title><?php echo $header_tags[title_tag]; ?></title>
<meta name="description" content="<?php echo $header_tags[desc_tag]; ?>">
<meta name="keywords" content="<?php echo $header_tags[keywords_tag]; ?>">

or

<title><?php echo ((strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1)) ? $header_tags['products_name'] . ' - ' . $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?>
</title>
<meta name="description" content="<?php echo $header_tags['products_name'] . strip_tags($breadcrumb_tags->trail_tags(' ')); ?>">
<meta name="keywords" content="<?php echo $header_tags['products_name'] . strip_tags($breadcrumb_tags->trail_tags(', ')); ?>">

may be one of them works for you?

 

Ken - I was using the second method and it didn't work. When I tried the simpler, first method, everything's working just fine -- thanks!

 

Two feature requests:

 

1) Can you think of any way to include the manufacturer name in the title and keywords?

 

2) Also - I think you need to strip out quotation marks (\") in the descriptions as it breaks the HTML meta tag

 

Thanks again for a GREAT Contrib!

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...