Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Tags for novices


GemRock

Recommended Posts

There is one that has default keywords and descriptions for pages that are not product related. It's called custom meta tags per item. I am trying to find a way to incorporate some of its code with this one as that one REQUIRES you enter descriptions and keywords in admin or you get the default for those products. I'm hoping to find a way for this code to call a default string if the keyword and/or description fields are blank due to being on a non-product page.

OK I'm sure this code can be cleaned up some but if you need default keywords and descriptions on non product pages use this code where you replaced the <title> tags in the head. (can be used on any page)

Original code

<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(', ')); ?>">

replace with

<title><?php echo (strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title>
<?php if (isset($HTTP_GET_VARS['products_id'])) { ?>
<meta name="description" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(' ')); ?>">
<?php } else { ?><meta name="description" content="<?php echo $Description;?>"><?php } ?>
<?php if (isset($HTTP_GET_VARS['products_id'])) { ?>
<meta name="keywords" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(', ')); ?>">
<?php } else { ?><meta name="keywords" content="<?php echo $Keywords;?>"><?php } ?>

then in application_top.php add this before the final ?>

 $Keywords="Default Keywords go here...";
 $Description="Default description goes here...";

Hope this helps sombody and I have'nt stepped on any toes!

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

Hello,

 

I'm am a happy user of your HTFN contrib and i was wondering,

I want to install the AllProducts contrib and i wanted to know if i should skip step

6+7 for the Header Tags contrib or i should instal it as well

Thanks in advance

Yossi

 

Hi Yossi

 

Thank you but I dont know what the step 6+7 is. I suppose it is not HT4N as there's no step 6 or 7 in the installation instructions. and I dont know what step 6+7 is either if it refers to the all products contribution.

What I can say is I dont see there would generally be any conflict between the two contributions.

 

Ken

ps. again please do not pm/email me unless you are invited to. I will be notified every time a post is added to this support thread.

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

php 4.3.10

apache 1.3.33

mysql 4.1.9

Anyone who uses php 4.4.x or above gets this error? I havent been able to find a php version lower than 4.4.x to test it.

 

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

There is one that has default keywords and descriptions for pages that are not product related. ...

If none-product pages are your *focus* then you could try Bill's tip. I personally would not recommend it. :( Reason being: you still need to get into every (none-product) php file (page) and add the custom header tags code, so why not just key in your description & keywords straightaway in that php file(page), as these pages would not have dynamic contents like the products pages.

 

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

Is it working with the Safe url on?

I would think so (I just did a test), although not recommend it. If you turn on (search engine) Safe URL, which is still in development as far as osc 2.2 is concerned, it will break contributions such as ultimate seo urls.

 

Anyway, you could test it yourself: you only need to modify one file, which is application_top.php. If it is not working then you could simply replace it with your backup.

 

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

  • 3 weeks later...

Ken, thank you so much for this great constribution. I have a problem in admin/header_tags_edit.php.

 

 

Max Displaying of 8 products in each category.

<< Page 1 of 5 >> max 8 products. Page 2/3/4/5 & Display Products per page won't work.

 

Same 8 products. like this when click page 2.

admin/header_tags_edit.php?&cPath=14&sort_by=&row_by_page=8&page=2

 

When I change -> Display Products per page 50. Nothing changes

admin/header_tags_edit.php?manufacturer=&cPath=14&row_by_page=50

 

Do you know what causing this? Thanks

Edited by blafrog
Link to comment
Share on other sites

Ken, thank you so much for this great constribution. I have a problem in admin/header_tags_edit.php.

Well, I just tested it on a few osc shops and I did not see the problem as mentioned in your post, and in my memory, i have never come across anything like that. So I cant offer immediate solution for you, apart from suggesting you to tyake a look at your site to see if there's any other part of your site that has same function (changing pages) and if they work there, especially in admin area. Also try to replace the file in question with the one from download, or download another copy of this contribution. If all fail, then post back with more details like version of osc, php, any contrib installed at admin side...

 

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

Have replaced new files no help. In admin, I have no problems changing page except Edit Header Tags. I can change categories page, but the page per display and page 2/3/4/5 don't work. Max 8 products in each categories.

 

I have Multi Vendor Shipping installed, Osc 2.2 Milestone 2 060817, PHP 4.42.

Link to comment
Share on other sites

Osc 2.2 Milestone 2 060817 has some known issues under some situations. Take a look at the thread osCommerce 2.2 Milestone 2 060817 Update Released under News & Announcemenmt section, to see applying those fixes solve your 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

  • 2 weeks later...
Hi,

First thanks for the great contribution.

 

I am trying to customize Header tags for novice. I would like to remove "Category" from the title.

 

Can you please advice me how to do it?

 

Best , Val (ValKiller)

Thanks Val. You can try either to comment out this line in application_top.php:

 

$breadcrumb_tags->add($categories['categories_name']);

so that it looks like:

//   $breadcrumb_tags->add($categories['categories_name']);

 

Or you can change the title tag in index.php to:

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

 

Or do both.

 

Ken

(Please post your question here as someone else may have the same problem/question so that there's no need to answer every time & each time for the same question)

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

Hello,

 

I'm having a little issue - could you assist me with it?

 

Currently the page titles on the product pages are displaying as Category: Page Title

 

I have tried to remove the category, but can't figure out how to. Could you fix this issue for me?

 

Thank you very much

Link to comment
Share on other sites

HI Val

 

Did you not see my answer above? Or that did not solve your 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

Hello Ken,

I love this contribution. However, I can't get around one problem. So instead of going to the general folks, I came to the creator :)

 

When I log on as admin, catalogs/products and click on my catalog folder, I receive this error message.

 

Fatal error: Call to a member function on a non-object in /home/dixonumc/public_html/first-in-line/admin/includes/application_top.php on line 189

 

This is what line 189 has using Dreamweaver:

Line 189:// ('language' in the filename is automatically replaced by available languages)

 

The following line:

 

$cache_blocks = array(array('title' => TEXT_CACHE_CATEGORIES, 'code' => 'categories', 'file' => 'categories_box-language.cache', 'multiple' => true),

array('title' => TEXT_CACHE_MANUFACTURERS, 'code' => 'manufacturers', 'file' => 'manufacturers_box-language.cache', 'multiple' => true),

array('title' => TEXT_CACHE_ALSO_PURCHASED, 'code' => 'also_purchased', 'file' => 'also_purchased-language.cache', 'multiple' => true)

);

otherwise Ken, all is fine. One more question, how many words can I add to the keyword box in The "header_tags_edit.php"

 

I'm learning so please be patient with us novice users.

Sheryl

Hi Shery

Your question 1 doesnt seem related to my contribution, so I cant answer that, not least when I dont have much time.

Both title and keywords can have a maximum of 256 characters, which could be changed in the products_description table (title_tag and keywords_tag), if you like.

 

Ken

PLeaes next time do not send email/pm to me regarding support of this contrib, thank you.

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 Val. You can try either to comment out this line in application_top.php:

 

$breadcrumb_tags->add($categories['categories_name']);

so that it looks like:

//   $breadcrumb_tags->add($categories['categories_name']);

 

Or you can change the title tag in index.php to:

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

 

Or do both.

 

Ken

(Please post your question here as someone else may have the same problem/question so that there's no need to answer every time & each time for the same question)

 

 

I didn't saw the reply (how lame of me).

 

I commented

$breadcrumb_tags->add($categories['categories_name']);

in the application top.

But now its gone only when I view a category, when I am in product view its still there.

Link to comment
Share on other sites

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

 

When I add this to the title tag in products_info.php I get the standart title

Link to comment
Share on other sites

I didn't saw the reply (how lame of me).

 

I commented

$breadcrumb_tags->add($categories['categories_name']);

in the application top.

But now its gone only when I view a category, when I am in product view its still there.

 

 

I also commented

   // if (strlen($categories['categories_name'])>1) $header_tags[title_tag] = $categories['categories_name'] . ' ' . $header_tags[title_tag];

 

and now its ok

Link to comment
Share on other sites

This is the support thread for the Header Tags For Novices Contribution, which can be found:

 

http://www.oscommerce.com/community/contributions,4822

Hello GemRock, I need your help. Your Contribution Header Tags for Novice ver 2. can't get inot my catalog folder anymore. I sent you an e-mail with the error and the application code. Everything else is just fine :)

Error: Cannot locate object in application header.php line 189

Thanks,

Sheryl

Link to comment
Share on other sites

I have answered your questions. Please scroll back this page and you will see it.

You may try to comment out line 189 - 192 (or 190 -193), ie that block od code that causes the error. btw, my contribution does not alter the application_top.php under admin/includes/

 

Ken

Hello GemRock, I need your help. Your Contribution Header Tags for Novice ver 2. can't get inot my catalog folder anymore. I sent you an e-mail with the error and the application code. Everything else is just fine :)

Error: Cannot locate object in application header.php line 189

Thanks,

Sheryl

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

Gemrock, First let me add to the rest of the Kudo's you have received so much of for this cont., however, like so many others, I also have a problem. After installation I went to check everything and all worked well until I added

 

<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(', ')); ?>">

 

as the instructions say. As soon as I done that and refreshed the page I got the following error,

 

Call to a member function on a non-object in /home/........./index.php on line 52.

 

everything else seems to work fine, I even edited some of the header tags via the .....admin.header_edit.php and I also installed the code for the product_info.php with no adverse effects. It just seems to be in the index.php file that is giving me fits. Any Ideas.

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

Link to comment
Share on other sites

After more research, it seems as if the problem is in the last 2 lines;

 

<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 added each, one at a time and together and I get the same error starting at the line the above two lines of code are inserted. I am continuing to work on the issue and will let you know if I arrive at a solution but would like to know what you think, I'm sure you can tell me quicker then I can work through it. Thanks much!

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

Link to comment
Share on other sites

Hi slackerjack

 

I thinkk you forgot to upload the file breadcrumb_tags.php to /includes/classes/ folder, or you uploaded it to the wrong place.

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

That's what I thought originally but it's there. I even double checked it after your reply and went and uploaded it again just in case it was corrupted or something and still no luck. I'm sure whatever it is, I'm going to feel really stupid because I know it's right in front of me and I can't see it.

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

Link to comment
Share on other sites

Post you line 52 ( or as well as 51, 53)?

 

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'm not sure what you mean but I'll try and answer as best I can. If my code looks like this

 

 

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

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

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

 

 

Then I will get the fault

 

Fatal error: Call to a member function on a non-object in /home/................./html/index.php on line 51

 

Hope this answers your question.

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

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