Jump to content
Sign in to follow this  
Farrukh

[Contribution] Header Tags Controller for Admin MS 2.2

Recommended Posts

Hey All...

 

I have this contribution installed and it appears to be working on all pages EXCEPT product_reviews_info.php where I get the following:

 

Fatal error: Call to undefined function: tep_get_header_tag_products_desc() in /home/xxxxxx/public_html/my_catalog/includes/header_tags.php on line 168

 

I cruised the previous posts and did not see anything when this occurs on only one page. Did I miss something?

 

 

I did check product_reviews_info.php and it seems the changes were made properly. (It is the same as other files in the header changes)

 

Thanks in advance.


Steve K AKA - Knipper -

Share this post


Link to post
Share on other sites

Ok, im backa again. Everything except the review is working correctly. When I go to view or add a product review I get a

Fatal error:  Call to undefined function:  tep_get_header_tag_products_desc() in /home/pnwgifts/public_html/includes/header_tags.php on line 168
Seems like i've been here before. :lol:

 

That section says:

// PRODUCTS_REVIEWS_INFO.PHP and PRODUCTS_REVIEWS.PHP
 case ( strstr($_SERVER['PHP_SELF'],'product_reviews_info.php') or strstr($_SERVER['PHP_SELF'],'product_reviews.php') or strstr($PHP_SELF,'product_reviews_info.php') or strstr($PHP_SELF,'product_reviews.php') ):
   if ( HEAD_DESC_TAG_PRODUCT_REVIEWS_INFO=='' ) {
     if ( HTDA_PRODUCT_REVIEWS_INFO_ON=='1' ) {
       $the_desc= tep_get_header_tag_products_desc(isset($HTTP_GET_VARS['reviews_id'])) . ' ' . HEAD_DESC_TAG_ALL;
     } else {
       $the_desc= tep_get_header_tag_products_desc(isset($HTTP_GET_VARS['reviews_id']));
     }
   } else {
     $the_desc= HEAD_DESC_TAG_PRODUCT_REVIEWS_INFO;
   }

   if ( HEAD_KEY_TAG_PRODUCT_REVIEWS_INFO=='' ) {
     if ( HTKA_PRODUCT_REVIEWS_INFO_ON=='1' ) {
       $the_key_words= tep_get_header_tag_products_keywords(isset($HTTP_GET_VARS['reviews_id'])) . ' ' . HEAD_KEY_TAG_ALL;
     } else {
       $the_key_words= tep_get_header_tag_products_keywords(isset($HTTP_GET_VARS['reviews_id']));
     }
   } else {
     $the_key_words= HEAD_KEY_TAG_PRODUCT_REVIEWS_INFO;
   }

   if ( HEAD_TITLE_TAG_PRODUCT_REVIEWS_INFO=='' ) {
     if ( HTTA_PRODUCT_REVIEWS_INFO_ON=='1' ) {
       $the_title= tep_get_header_tag_products_title(isset($HTTP_GET_VARS['reviews_id'])) . ' - ' . HEAD_TITLE_TAG_ALL;
     } else {
       $the_title= tep_get_header_tag_products_title(isset($HTTP_GET_VARS['reviews_id']));
     }
   } else {
     $the_title= HEAD_TITLE_TAG_PRODUCT_REVIEWS_INFO;
   }

   break;

 

Thanks for all your help on this.. Im starting to understand this php Thing a bit more.

Should I just use the new auto install and hope for the best?

 

Thanks

Edited by PnwGifts

Share this post


Link to post
Share on other sites

Look in the includes/functions directory. You should have a header_tags.php file there. It sounds like it is missing.

 

Jack

Share this post


Link to post
Share on other sites

Hey Jack...

 

Mine is there and in place. Any other suggestions? As mentioned, it appears all other pages work fine, it's only the "product_reviews_info.php" that is throwing the error.

 

As a side note, I did an install on a different domain and get the same error on the same page.

 

Another side note... on original install I had a function error, and had to move WHERE the function was being called (it was too close to the top of the page) I moved it down, and that fixed it.

 

Just FYI.

 

Look in the includes/functions directory.? You should have a header_tags.php file there.? It sounds like it is missing.

 

Jack

Edited by knipper

Steve K AKA - Knipper -

Share this post


Link to post
Share on other sites

That function is only called by the review pages. That's why you are just gettng the error with those pages. Try reloading the file. Maybe download an earlier version of HTC. You may have a corrupted file.

 

Jack

Share this post


Link to post
Share on other sites
Are you using STS?  I think it gets declared twice sometimes with that package.  Try this:  Remove the comment I mentioned above.  In includes/application_top.php, change this line
require(DIR_WS_FUNCTIONS . 'header_tags.php');

to this

//require(DIR_WS_FUNCTIONS . 'header_tags.php');

What happens now?

 

Jack

Share this post


Link to post
Share on other sites
Are you using STS?  I think it gets declared twice sometimes with that package.  Try this:  Remove the comment I mentioned above.  In includes/application_top.php, change this line
require(DIR_WS_FUNCTIONS . 'header_tags.php');

to this

//require(DIR_WS_FUNCTIONS . 'header_tags.php');

What happens now?

 

Jack

 

**

I just went through the same exercise. I had a double declaration in application_bottom.php which I changed to:

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0

// Commented out the following because it caused error problems:

// require(DIR_WS_FUNCTIONS . 'header_tags.php');

// Commented out the following because it caused error problems:

// Clean out HTML comments from ALT tags etc.

 

It was duplicating sts_display_output.php

 

Gomer

Share this post


Link to post
Share on other sites
Look in the includes/functions directory.  You should have a header_tags.php file there.  It sounds like it is missing.

 

Jack

Yes i have it. here it is:

<?php
// /catalog/includes/functions/header_tags.php
// WebMakers.com Added: Header Tags Generator v2.0

////
// Get products_head_title_tag
// TABLES: products_description
function tep_get_header_tag_products_title($product_id) {
 global $languages_id, $HTTP_GET_VARS; 

 $product_header_tags = tep_db_query("select products_head_title_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . (int)$languages_id . "' and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
 $product_header_tags_values = tep_db_fetch_array($product_header_tags);

 return clean_html_comments($product_header_tags_values['products_head_title_tag']);
 }


////
// Get products_head_keywords_tag
// TABLES: products_description
function tep_get_header_tag_products_keywords($product_id) {
 global $languages_id, $HTTP_GET_VARS; 

 $product_header_tags = tep_db_query("select products_head_keywords_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . (int)$languages_id . "' and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
 $product_header_tags_values = tep_db_fetch_array($product_header_tags);

 return $product_header_tags_values['products_head_keywords_tag'];
 }


////
// Get products_head_desc_tag
// TABLES: products_description
function tep_get_header_tag_products_desc($product_id) {
 global $languages_id, $HTTP_GET_VARS; 

 $product_header_tags = tep_db_query("select products_head_desc_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . (int)$languages_id . "' and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
 $product_header_tags_values = tep_db_fetch_array($product_header_tags);

 return $product_header_tags_values['products_head_desc_tag'];
 }

?>

Is that correct?

Share this post


Link to post
Share on other sites

Try replacing your includes/header_tags.php and your includes/languages/english/header_tags.php files. Do them one at a time and be sure to back up your originals. It could be that when you made a change to one of the files, you introduced an error into the code. If that doesn't work, post them here and I'll see if they fail on my computer.

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack,

 

Thanks for the help. I replaced both files with original downloaded versions, with NO changes at all. (Just the default as is) And get the same problem.

 

One additional note... I had been reading multiple threads, and realized that I wasn't in the one I thought.

 

One piece of info you didn't know is that I am using STS as well.

 

Not sure if that is what is actually causing the problem, and not this contribution on its own. I wonder if PnwGifts is also using STS?

 

Thanks again, looking forward to your reply.

 

 

Try replacing your includes/header_tags.php  and your includes/languages/english/header_tags.php files.  Do them one at a time and be sure to back up your originals.  It could be that when you made a change to one of the files, you introduced an error into the code.  If that doesn't work, post them here and I'll see if they fail on my computer.

 

Jack


Steve K AKA - Knipper -

Share this post


Link to post
Share on other sites

I was recently conversing with another member about the same problem. He found that, because of STS, he had removed the line in application_top that loads this function. Here is what the instructions say to add to that file. Is this what you have?

// BOF: WebMakers.com Added: Header Tags Controller v1.0
 require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
 require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

Jack

Share this post


Link to post
Share on other sites

Hi again Jack....

 

Actually I have one additional Line commented out as it was causing a problem with "header tags.php" already being loaded. Here's what I have:

// BOF: WebMakers.com Added: Header Tags Controller v1.0
//require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
? require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

But kep in mind, all other pages except the review page work normally. :o

 

Edit: Just for the heck of it I uncommented the line to see what would happen, I get this:

Fatal error: Cannot redeclare tep_get_header_tag_products_title() (previously declared in /home/mysite/public_html/my_catalog/includes/functions/header_tags.php:8) in /home/mysite/public_html/my_catalog/includes/functions/header_tags.php on line 8

 

Works OK again when I comment out the line. (except the reviews page)

 

 

I was recently conversing with another member about the same problem.? He found that, because of STS, he had removed the line in application_top that loads this function.? Here is what the instructions say to add to that file.? Is this what you have?
// BOF: WebMakers.com Added: Header Tags Controller v1.0
?require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
?require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

Jack

Edited by knipper

Steve K AKA - Knipper -

Share this post


Link to post
Share on other sites
Hi again Jack....

 

Actually I have one additional Line commented out as it was causing a problem with "header tags.php" already being loaded.  Here's what I have:

// BOF: WebMakers.com Added: Header Tags Controller v1.0
//require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
? require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

But kep in mind, all other pages except the review page work normally.  :o

 

Edit:  Just for the heck of it I uncommented the line to see what would happen, I get this:

Works OK again when I comment out the line. (except the reviews page)

As I mentioned, the reviews are the only one that uses that so that why you only see the error there. Search your code for
require(DIR_WS_FUNCTIONS . 'header_tags.php');

I know STS has it declared in one of its files. Try removing it from there and enabling it in application_top. Also be sure you don't have it anywhere else.

 

Jack

Share this post


Link to post
Share on other sites

Jack... You're a genius! :lol:

 

I found the line in includes/STS_display_output.php and commented it out... then removed the comment from Application_top.php (making it active)...

 

And it worked! All seems well and good, and no other problems that I can see at this point.

 

Thank you!

 

 

I do need to figure out what line to comment out to avoid having my e-mail address show in the header though. Had it once before... Need to find it again.

 

:D :D

As I mentioned, the reviews are the only one that uses that so that why you only see the error there.  Search your code for
require(DIR_WS_FUNCTIONS . 'header_tags.php');

I know STS has it declared in one of its files.  Try removing it from there and enabling it in application_top.  Also be sure you don't have it anywhere else.

 

Jack


Steve K AKA - Knipper -

Share this post


Link to post
Share on other sites

I'm glad you got it sorted out. :)

 

The email is defined at the top of the english/header_tags.php file and then included by the includes/header_tags.php file. I have mine removed completely. It serves no purpose nowadays other than a flag for spammers IMO.

 

Jack

Share this post


Link to post
Share on other sites
Jack... You're a genius!  :lol:
I second that. :D

 

Yeah, I have sts as well and that fixed it as well. Thank you for your time and effort you put into this jack. :thumbsup:

 

Gary

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Just about done installing this and I have a question about the next to last admin change:

 

Find the following (approx line 768)

    $languages = tep_get_languages();
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
     if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
       $pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
       $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
       $pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);
     } else {
       $pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]);
       $pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]);
       $pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);
     }
     
Replace with the following    
        
   $languages = tep_get_languages();
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
     if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
       $pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
       $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
       $pInfo->products_head_title_tag = tep_db_prepare_input($products_head_title_tag[$languages[$i]['id']]);
       $pInfo->products_head_desc_tag = tep_db_prepare_input($products_head_desc_tag[$languages[$i]['id']]);
       $pInfo->products_head_keywords_tag = tep_db_prepare_input($products_head_keywords_tag[$languages[$i]['id']]);
       $pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);
     } else {
       $pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]);
       $pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]);
       $pInfo->products_head_title_tag = tep_db_prepare_input($products_head_title_tag[$languages[$i]['id']]);
       $pInfo->products_head_desc_tag = tep_db_prepare_input($products_head_desc_tag[$languages[$i]['id']]);
       $pInfo->products_head_keywords_tag = tep_db_prepare_input($products_head_keywords_tag[$languages[$i]['id']]);
       $pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);
     }

 

I'm relatively new to PHP (but not to coding), and from the pattern of this If... Else... construct, the first set of statements - in the original code - in the IF section are all performing a tep_get_products_xxx function and in the ELSE section they are all performing a tep_db_prepare_input function.

 

Why is it that the HTC statements in the IF section are in the tep_db_prepare_input format and not the tep_get_products_xxx format?

 

Thanks!

 

Larry

Share this post


Link to post
Share on other sites

While I'm at it, I discovered that the following line of code - which the instructions say to add to admin/categories.php - does not have a corresponding DEFINE statement.

 

            <td colspan="2" class="main"><hr><?php echo TEXT_PRODUCT_METTA_INFO; ?></td>

 

Somewhere in admin/includes/language/english/categories.php, the following statement is needed:

 

define('TEXT_PRODUCT_METTA_INFO', 'Meta Tag Information');

 

This will let you see the area heading when you are using admin to add (or browse) a product.

 

Perhaps spelling METTA without two T's could be encouraged... :blink:

 

Larry

Share this post


Link to post
Share on other sites

I have today installed this contrib on my test server, (Laptop), and all went well. However, it has changed the title of the site to osCommerce!!

 

How do I get it to show the correct title of the site?

 

Many thanks


'Don't go to the Dark Side! Although ignorance and prejudice are as rampant in web design as in any other human endeavour, web standards are here to stay' - Jeffrey Zeldman - Designing With Web Standards

 

Knowledge Base | Contributions | Tips & Tricks Forum

Share this post


Link to post
Share on other sites

It doesn't work by itself. You have to edit it to fit your site. Find the following line in includes/languages/english/header_tags.php and put in the title you prefer

define('HEAD_TITLE_TAG_ALL','osCommerce : ');

 

Jack

Share this post


Link to post
Share on other sites
It doesn't work by itself.? You have to edit it to fit your site.? Find the following line in includes/languages/english/header_tags.php and put in the title you prefer
define('HEAD_TITLE_TAG_ALL','osCommerce : ');

 

Jack

Thanks Jack. After installing on the lappie, I had a root around on the train on the way home from work and found it.

 

Personally I think the contrib could do with some better documentation, outlining a little more what all the bits do. It seems to me a little vague as is. Good contrib though.

Edited by Delicata

'Don't go to the Dark Side! Although ignorance and prejudice are as rampant in web design as in any other human endeavour, web standards are here to stay' - Jeffrey Zeldman - Designing With Web Standards

 

Knowledge Base | Contributions | Tips & Tricks Forum

Share this post


Link to post
Share on other sites

Hello

 

First I want to say thanks to Jack and everyone for their work on this much needed contribution. You guys are awesome.

 

I just installed the Header Tags Controller v2.3.5

Update by: Jack_mcs

Date: 20 October 2004

 

It did not work and I got the following error:

 

Warning: main(DIR_WS_FUNCTIONSheader_tags.php): failed to open stream: No such file or directory in /home/htdocs/users/ebonni34/ebonni34/hockeyheadquarters.com/catalog/includes/application_top.php on line 14

 

Fatal error: main(): Failed opening required 'DIR_WS_FUNCTIONSheader_tags.php' (include_path='.:/usr/local/lib/php') in /home/htdocs/users/ebonni34/ebonni34/hockeyheadquarters.com/catalog/includes/application_top.php on line 14

 

the files it is talking about are indeed in place

 

I checked out this support thread and found where it says to comment out part of the application_top.php file... the part to comment out was line 14 in my file.

 

So I commented out as follows

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0
//  require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
 require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

Then I recieved the following error:

 

Warning: main(DIR_WS_FUNCTIONSclean_html_comments.php): failed to open stream: No such file or directory in /home/htdocs/users/ebonni34/ebonni34/hockeyheadquarters.com/catalog/includes/application_top.php on line 16

 

Fatal error: main(): Failed opening required 'DIR_WS_FUNCTIONSclean_html_comments.php' (include_path='.:/usr/local/lib/php') in /home/htdocs/users/ebonni34/ebonni34/hockeyheadquarters.com/catalog/includes/application_top.php on line 16

 

So again I commented out line 16 as follows

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0
//  require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
//  require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

Now my store at least appears online again.

 

When I tried to login to the admin area I recieved a similar error for the catalog/admin/inludes/application_top.php file

 

So I commentted out the same section of code as above... but now I get this error...

 

Warning: main(includes/classes/navigation_history.php): failed to open stream: No such file or directory in /home/htdocs/users/ebonni34/ebonni34/hockeyheadquarters.com/catalog/admin/includes/application_top.php on line 136

 

Fatal error: main(): Failed opening required 'includes/classes/navigation_history.php' (include_path='.:/usr/local/lib/php') in /home/htdocs/users/ebonni34/ebonni34/hockeyheadquarters.com/catalog/admin/includes/application_top.php on line 136

 

 

I would really like to get this contribution working and would appreaciate anyones help on what is wrong here. I am a beginner when it comes to php and mysql so forgive me if I am missing something obvious.

 

Any ideas on where I should start to fix this?

 

Thanks

Eric B


AJ2000

Share this post


Link to post
Share on other sites
// BOF: WebMakers.com Added: Header Tags Controller v1.0
// ?require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
?require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

IIRC, the correct code in this section SHOULD be

// BOF: WebMakers.com Added: Header Tags Controller v1.0
 require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

Although it may say line 14, you have to take into account any mods you may have made to the files INCLUDING the current mod you are doing.

 

Does it tell you what to look for around that line? I can't check as I am work at the moment.


'Don't go to the Dark Side! Although ignorance and prejudice are as rampant in web design as in any other human endeavour, web standards are here to stay' - Jeffrey Zeldman - Designing With Web Standards

 

Knowledge Base | Contributions | Tips & Tricks Forum

Share this post


Link to post
Share on other sites

Hi John,

 

Thanks for the response... but if you look at my question a little more closely you will see that I did have the correct code as you state is should be...

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0
require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

And that is what caused the errors. If you can go back and read my original post a little more carefully and let me know what you think I would really appreaciate it.

 

I put that code at the top of the application_top.php file that is why it is showing line 14 and 16 as the error line.

 

Thanks

Eric B

 

 

IIRC, the correct code in this section SHOULD be

// BOF: WebMakers.com Added: Header Tags Controller v1.0
?require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

Although it may say line 14, you have to take into account any mods you may have made to the files INCLUDING the current mod you are doing.

 

Does it tell you what to look for around that line?  I can't check as I am work at the moment.


AJ2000

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×