Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Tags for novices


GemRock

Recommended Posts

Sorry, but I have to ask you again: the file should be uploaded to (catalog)/includes/classes/ folder, NOT the admin/includes/classes/ folder, as I can not see there'd be anything wrong in the three lines you added to index.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

Also, I don't know if one has anything to do with the other, but in product_info.php, when I am using my browser and "view page source" all I get is

 

 

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

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

 

and not the description or keywords like I think I should see. But I do not get an error, hope this helps sort it out.

I'm not in the middle of nowhere, but I can see it from here!

Link to comment
Share on other sites

I have the file (and just to make sure I checked and uploaded the file for the 4th time) in catalog/includes/classes/breadcrumb_tags.php right under breadcrumb.php and cc_validation.php. I am positive the file is not in admin/includes/classes/, I went and looked hoping that maybe I had copied it into both places and it was causing a problem, this was not the case.

I'm not in the middle of nowhere, but I can see it from here!

Link to comment
Share on other sites

The product_info.php uses different meta tags from those used in the index.php (thats why there's no error). Double check your installation, or still no luck, I suggest you turn off your computer and gp do something else, then return to your pc, you then will find the problem :) . I am running out of ideas as to what causes your problem.

 

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

Just tried to reproduce the error, it is something to do with the application_top.php. Double check that part of instructions. These two lines to be added there:

 

require(DIR_WS_CLASSES . 'breadcrumb_tags.php');

$breadcrumb_tags = new breadcrumb_tags;

 

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

Ok, that seems to have taken care of the problem, no more errors. Now how do I check to see if I am getting the proper information back. I used "view page source" and this is what I'm getting back

 

 

<title> - Bear Creek Leather</title>

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

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

 

I'm not seeing any info in the description or the keywords, but I also don't know if I'm checking it correctly.

I'm not in the middle of nowhere, but I can see it from here!

Link to comment
Share on other sites

...<title> - Bear Creek Leather</title>

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

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

Thats what you'd see in index.php when you havent clicked on any category/manufacturer. If could add some default desc & keywords like:

 

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

 

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 see that no matter where I am. Even if I change categories or go into product info. I added some keywords and a description as you described and it shows up but it does not change no matter where I go on the site. If it would help, my site is www.bearcreekleather.com . Once there if you use the "view page source" function of your browser you'll see that no matter where you go on the site, the only description or keywords you'll see are the default ones that I have hard coded in. I really like this contribution and want to get it to work and hope that this will help anyone else who has these same problems.

I'm not in the middle of nowhere, but I can see it from here!

Link to comment
Share on other sites

Also, I add the additional two lines at the top of the page with the other includes, I assume that's where they go?

That says you did not follow ALL (line by line or word by word) th einstructions properly, I am afraid.

 

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

Just tried to reproduce the error, it is something to do with the application_top.php. Double check that part of instructions. These two lines to be added there:

 

require(DIR_WS_CLASSES . 'breadcrumb_tags.php');

$breadcrumb_tags = new breadcrumb_tags;

 

Ken

 

 

That was meant for the reply that you had given me reguarding these two lines of code. You didn't specify where to put then other the in the file application_top.php. I have went over and over the instructions that were included with the contrib even reinstalled it with clean backup files only to reach the same conclusion.

I'm not in the middle of nowhere, but I can see it from here!

Link to comment
Share on other sites

That was meant for the reply that you had given me reguarding these two lines of code. You didn't specify where to put then other the in the file application_top.php. I have went over and over the instructions that were included with the contrib even reinstalled it with clean backup files only to reach the same conclusion.

 

I can not believe it that you would miss the instruction regarding where the two lines (and along others I think) should be! No more answer from me I am afraid as all the answers to your problem are in the two sets of instructions. you just need to read them carefully and follow them.

 

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

...went over and over the instructions that were included with the contrib even reinstalled it with clean backup files only to reach the same conclusion.

Glad to know (via pm) you had it work afterward. Yes after long hrs working on a computer, we do often look at the screen but can't see the problem.

 

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

You download it to anywhere (provided you take a note wherer it is) on your local pc, and then you upload the files (some after edit, others directly. see instructions for details) to the respective folder(s) on the server that hosts your osC store, jusy like you do to any other contributioins.

 

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

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

 

How would I edit that code in index.php so that it will display "Title - Category - Manufacturer" instead of "Category - Manufacturer - Title" ?

 

Your help would be much appreciated. It is a great contribution =)

Link to comment
Share on other sites

You could change it so that it looks like this:

 

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

How would I edit that code in index.php so that it will display "Title - Category - Manufacturer" instead of "Category - Manufacturer - Title" ?

 

Your help would be much appreciated. It is a great contribution =)

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

First let me say that this is a FANTASTIC contribution - thank you GemRock!

 

However, I have found some interesting issues that I wanted to present. I am using the STS template system and have everything working just fine with the additional STS modifications mentioned in this thread - with a few exceptions.

 

(1.) One thing that I have found is in regard to product searches. If I perform a "quick search" from my index page and pull up a specific product, the title, description and keywords are generated correctly on the resultant product page. However, when I do an "advanced search" and pull up the same products, only the description and keyword tags appear - no title tag information is being pulled from the database. Understanding that advanced searches pull additional information (manufacture info etc.) I'm curious as to a "fix" that would generate the proper title tags. Here is an example URL search result with a sample product:

 

"advanced search" product page link result: product_info.php?manufacturers_id=&products_id=2

"quick search" product page link result: product_info.php?products_id=2

 

Has anyone else experience the same issue?

 

(2.) For some reason pages are not pulling the title tag information from the database when I edit the products meta tags through the contributions admin edit page (header_tags_edit.php). The three fields (title, description and keywords) are being added to each product database entry, however, only the description and keywords are appearing on the actual pages that are generated. If I leave the field blank in the admin page (header_tags_edit.php), the title, description and keyword tags are generated correctly from the existing product information.

 

Does anyone experience anything similar?

 

(3.) Lastly - (I apologize for the lengthy post!) - I have edited my index.php page with the suggested modifications for title, description and keywords:

 

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

<meta name="description" content="<?php echo (strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1) ? strip_tags($breadcrumb_tags->trail_tags(' ')) : 'default description here'; ?>">

<meta name="keywords" content="<?php echo (strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1) ? strip_tags($breadcrumb_tags->trail_tags(' ')) : 'default keywords here'; ?>">

 

However, nothing is showing up except the default title of the shop as configured in the admin backend ("Configuration" section). This is the result of pulling the index.php page in my browser:

 

<title>osCommerce</title><meta name="description" content=""><meta name="keywords" content="">

 

Kind of strange as I would expect it to at least print the "default description here" and "default keywords here"

 

Any assistance would be GREATLY appreciated. Again - thank you GemRock for a most wonderful contribution!!!

Edited by Vibe
Link to comment
Share on other sites

Ok...I have pulled my head out of my rear and realize that my issue (#3) pertains to the STS template system and the /catalog/includes/modules/sts_inc/general.php page. I am working with the suggestions that other members had in this thread to see if I can have non-product pages pull "default" information through an alteration in the following function (approximately line 70 of my general.php file):

 

$sts->template['headertags']= "<title>test";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags(' - ')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' | ' . $header_tags[products_name] : TITLE;

$sts->template['headertags'] .= "</title>";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= $header_tags[desc_tag];

$sts->template['headertags'] .= "\"><meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= $header_tags[keywords_tag];

$sts->template['headertags'] .= "\">";

 

Thanks!

Link to comment
Share on other sites

Hi Vibe

 

Thank you for your feedback. your feedbacl is most appreciated.

 

Maybe the problems you were experiencing have something to do with the STS template system, which I have never used, although I have applied my contribution to other templates eg monstortemplate w/o problem. So, I can't be sure to say what might cause them. Perhaps you could pm me a link to your site so that I could take a look?

 

Good Luck!

 

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

Hi GemRock!

 

Thanks so much for your quick reply - it is certainly appreciated! I agree with you completely - I believe most if not all of my "issues" center around the use of the STS template system. However, if I can figure out a solution using your contribution + STS templates this will make a web designers/SEO marketers dream! I am also using Information Pages Unlimited which effectively allows for dynamic Content Management for any information page a user wants to create.

 

The main issue that I see now is the small bit of code that generates title, description and keyword tags used by STS in the catalog/includes/modules/sts_inc/general.php file (which was adapted for your contribution by users earlier in this thread). My Version of this code is the following:

 

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags(' - ')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' | ' . $header_tags[products_name] : TITLE;

$sts->template['headertags'] .= "</title>";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= $header_tags[desc_tag];

$sts->template['headertags'] .= "\"><meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= $header_tags[keywords_tag];

$sts->template['headertags'] .= "\">";

Link to comment
Share on other sites

Sorry...part of my post was cut off...

 

Hi GemRock!

 

Thanks so much for your quick reply - it is certainly appreciated! I agree with you completely - I believe most if not all of my "issues" center around the use of the STS template system. However, if I can figure out a solution using your contribution + STS templates this will make a web designers/SEO marketers dream! I am also using Information Pages Unlimited which effectively allows for dynamic Content Management for any information page a user wants to create.

 

The main issue that I see now is the small bit of code that generates title, description and keyword tags used by STS in the catalog/includes/modules/sts_inc/general.php file (which was adapted for your contribution by users earlier in this thread). My Version of this code is the following:

 

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags(' - ')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' | ' . $header_tags[products_name] : TITLE;

$sts->template['headertags'] .= "</title>";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= $header_tags[desc_tag];

$sts->template['headertags'] .= "\"><meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= $header_tags[keywords_tag];

$sts->template['headertags'] .= "\">";

 

This effectively generates the title, description & keyword tags for all product and category pages, and if modified correctly should produce the correct tags for the index.php and all dynamic pages generated by Information Pages Unlimited. The format above creates a title tag in the form of "Store Name + Cat + Subcat (if applicable) + Product title.

 

If I can figure out a way to output the title & meta tags (dependant on the page generated - e.g. index.php, category, product or information page) I will have the puzzle solved. I am currently working with the code you suggested earlier in this thread that includes the following:

 

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

<meta name="description" content="<?php echo (strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1) ? strip_tags($breadcrumb_tags->trail_tags(' ')) : 'add description here'; ?>">

<meta name="keywords" content="<?php echo (strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1) ? strip_tags($breadcrumb_tags->trail_tags(' ')) : 'add keywords here'; ?>">

 

I will PM you the site that I am working on. Thanks again for your quick reply - and again for a GREAT contribution!

 

Miguel

Link to comment
Share on other sites

...

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags(' - ')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' | ' . $header_tags[products_name] : TITLE;

$sts->template['headertags'] .= "</title>";

...

Hi Vibe

 

Again I must say I am not familiar with the STS contrib as I can always place osc elements anywhere I want so I do not need STS, which I suppose is designed basically for those who don't have program skills but want their osc store look different from the stock theme.

But on the face of it, based on the code you posted above, there may be a mistake in:

$header_tags[products_name]

, which would result in never showing what you enter for the page title in admin. I think that bit of code should be:

$header_tags[title_tag]

One would never need to use

$header_tags[products_name]

, because the $header_tags[title_tag] would be either what you enter in admin, or, if there's nothing entered, then it would be the product name anyway (default).

secondly, if you want to show your chosen title which you entered in admin, then you must make sure this condition is always FALSE:

(strlen($breadcrumb_tags->trail_tags(' - ')) > 0)

, i.e., it must always has fewer than one character (zero length). So, you could try to increase it to a bigger number, say, > 3, because somehow the

$breadcrumb_tags->trail_tags

may return a non-zero length string.

 

I have taken a look at your site, but since I don't have a STS setup, I can't reproduce the problem. Maybe some fellow members of this forum who use STS and my contrib can help you?

 

Good Luck!

 

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

One site owner asked the title, description and keywords tags to be like this:

 

category - subcategory (if any) - product name - description (in the case of description tag).

 

Here is how this can be done (without entries in admin using header_tags_edit.php):

 

<title><?php echo $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[products_name]; ?></title><BR><meta name="description" content="<?php echo $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[products_name] .' - ' . $header_tags[desc_tag]; ?>"><BR><meta name="keywords" content="<?php echo $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[keywords_tag]; ?>">

 

This shows the flexibility of this contribution. You could move around these elements the way you like.

 

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

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...