Jump to content
Sign in to follow this  
Farrukh

[Contribution] Header Tags Controller for Admin MS 2.2

Recommended Posts

I found my header tags are now changing on catalog/index.php but no other pages. Since I cant find the option in the admin to go in, I tried to just call up the header_tags_controller.php file directly.

 

There seems to be a few files missing in the latest update. Its calling

 

Warning: main(includes/languages/english/FILENAME_HEADER_TAGS_CONTROLLER): failed to open stream: No such file or directory in /home/ripperra/public_html/mall/catalog/admin/header_tags_controller.php on line 15

 

Fatal error: main(): Failed opening required 'includes/languages/english/FILENAME_HEADER_TAGS_CONTROLLER' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ripperra/public_html/mall/catalog/admin/header_tags_controller.php on line 15

 

Something is not defined here in the catalog side english directory, the zip only came with one file for that directory. I guess I will try an earlier release.

 

if it helps, here is what I have on line 15 of catalog/header_tags_controller.php

 

require('includes/application_top.php');

require('includes/functions/header_tags.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_HEADER_TAGS_CONTROLLER); $filenameInc = '..' . DIR_WS_CATALOG . 'includes/header_tags.php';

$filenameEng = '..' . DIR_WS_CATALOG . DIR_WS_LANGUAGES . $language . '/header_tags.php';

$action = (isset($HTTP_POST_VARS['action']) ? $HTTP_POST_VARS['action'] : '');

$actionDelete = (isset($HTTP_POST_VARS['action_delete']) ? $HTTP_POST_VARS['action_delete'] : '');

$actionCheck = (isset($HTTP_POST_VARS['action_check']) ? $HTTP_POST_VARS['action_check'] : '');

 

oops, I found the install_admin.txt

 

installing now and all may be well when Im done. Thanks!

Share this post


Link to post
Share on other sites

do you know why I would get this after doing all the admin stuff?

 

Warning: file(../mall/catalog/includes/languages/english/header_tags.php): failed to open stream: No such file or directory in /home/ripperra/public_html/mall/catalog/admin/header_tags_controller.php on line 251

 

the rest of the page loads normally (/mall/catalog/admin/header_tags_controller.php)

 

Keep in mind I do not have the catalog on the root. I am looking to see if thats the problem.

Edited by mike9999

Share this post


Link to post
Share on other sites

---------------------------------------------------------------------------------------

Several corrections to Header Tags Controller v2.5.5 Complete - Jack_mcs - 7 Sep 2005. 
The admin pages did not take into account that some folks may not have the catalog
in the root of the website. Provided that your configure.php is correct this should 
fix it for those with the catalog in the root and those with the catalog elsewhere.


-----------

file: catalog\admin\header_tags_controller.php


Find these lines about lines 17-18:

 $filenameInc = '../includes/header_tags.php';
 $filenameEng = '../' . DIR_WS_LANGUAGES . $language . '/header_tags.php';

Replace with these lines:

 $filenameInc = '..' . DIR_WS_CATALOG . 'includes/header_tags.php';
 $filenameEng = '..' . DIR_WS_CATALOG . DIR_WS_LANGUAGES . $language . '/header_tags.php';


Find this line about line 223:

 if ($handle = opendir('../')) 

Replace with this line:

 if ($handle = opendir('..' . DIR_WS_CATALOG)) 


-----------

file: catalog\admin\header_tags_english.php


Find this line about line 16:

 $filename = '../' . DIR_WS_LANGUAGES . $language . '/header_tags.php';

Replace with this line:

 $filename = '..' .DIR_WS_CATALOG. DIR_WS_LANGUAGES . $language . '/header_tags.php';



-----------

file: catalog\admin\includes\functions\header_tags.php


Find this line about line 68:

 $file = '../'.$file;

Replace with this line:

 $file = '..' . DIR_WS_CATALOG.$file;

 

this code in the "fix" didnt work for me, I had to go back to what came in the original release zip inside the release for this to work error free and do away with "file not found" errors. My store isnt even located in the root like the info states this would fix and it seems to be working fine without the changes. i dont know enough to be sure but these are my findings.

Edited by mike9999

Share this post


Link to post
Share on other sites

I have installed. Everything seems to be working fine except the admin section when i try to access the catalog.

 

It comes up with the following error:

 

 

Parse error: parse error, unexpected T_CASE in catalog2/admin/categories.php on line 997

 

The code around that section is the following:

 

?>

<tr>

<td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo TEXT_CATEGORIES . ' ' . $categories_count . '<br>' . TEXT_PRODUCTS . ' ' . $products_count; ?></td>

<td align="right" class="smallText"><?php if (sizeof($cPath_array) > 0) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, $cPath_back . 'cID=' . $current_category_id) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> '; if (!isset($HTTP_GET_VARS['search'])) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_category') . '">' . tep_image_button('button_new_category.gif', IMAGE_NEW_CATEGORY) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_product') . '">' . tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>'; ?> </td>

</tr>

</table></td>

</tr>

</table></td>

<?php

$heading = array();

$contents = array();

switch ($action) {

case 'new_category':

$heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_CATEGORY . '</b>');

 

$contents = array('form' => tep_draw_form('newcategory', FILENAME_CATEGORIES, 'action=insert_category&cPath=' . $cPath, 'post', 'enctype="multipart/form-data"'));

$contents[] = array('text' => TEXT_NEW_CATEGORY_INTRO);

 

// HTC BOC

$category_htc_title_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_htc_title_tag[' . $languages[$i]['id'] . ']');

$category_htc_desc_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_htc_desc_tag[' . $languages[$i]['id'] . ']');

$category_htc_keywords_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_htc_keywords_tag[' . $languages[$i]['id'] . ']');

$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'hard', 30, 5, '');

// HTC EOC

}

 

$contents[] = array('text' => '<br>' . TEXT_CATEGORIES_NAME . $category_inputs_string);

$contents[] = array('text' => '<br>' . TEXT_CATEGORIES_IMAGE . '<br>' . tep_draw_file_field('categories_image'));

$contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));

// HTC BOC

$contents[] = array('text' => '<br>' . 'Header Tags Category Title' . $category_htc_title_string);

$contents[] = array('text' => '<br>' . 'Header Tags Category Description' . $category_htc_desc_string);

$contents[] = array('text' => '<br>' . 'Header Tags Category Keywords' . $category_htc_keywords_string);

$contents[] = array('text' => '<br>' . 'Header Tags Categories Description' . $category_htc_description_string);

// HTC EOC

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

break;

case 'edit_category':

$heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_CATEGORY . '</b>');

 

$contents[] = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=update_category&cPath=' . $cPath, 'post', 'enctype="multipart/form-data"') . tep_draw_hidden_field('categories_id', $cInfo->categories_id));

$contents[] = array('text' => TEXT_EDIT_INTRO);

 

Thanks

Share this post


Link to post
Share on other sites
Around line 245 you will see this
	$category_query = tep_db_query("select cd.categories_htc_title_tag, cd.categories_htc_description from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");

Your changes need to change that to read in the manufacturers data instead of the categories data if a manufacturer page is being displayed.

 

There's no telling on the update. I just work on it when I have time. Could be this week or three months from now.

 

Jack

hi jack, did you happen to have a chance to work on the manufacturer's meta tags? :)

Share this post


Link to post
Share on other sites

Can someone let me know what the benefits of this script are? I've installed it and it seems a little vague on how to use it or what it does besides meta tags.

 

I was thinking I was installing a contrib that would put the items name up on the header bar, and automatically fill it in the meta tags? Is that correct?

 

Im also very confused about the extra pages. since I am mainly concerned about the products pages, and there is only one products page for all the different products why do I have to make just one set of tags for that page? cant it see the title of the item and put that in there?

Edited by mike9999

Share this post


Link to post
Share on other sites

Cow992 - That type of error usually means there is an error in the file in the english directory, in this case categories.php. If you haven't changed any text, tehn it may be in the contribution. Try using the files, admin/categlores.php and admin/includes/languages/english/categories.php from the 2.5.5 archive by me. I know that one wroks.

 

eww - No, I'm sorry, but I haven't even come close to taking a look at it.

 

Michael - The benefits are tremendous if you set it up properly. By installing Header Tags, you can take a site that is not ranked, or not ranked well, and reach a high position in the SE listings. The key is the setting it up. It is a tool. You can't just install it and expect much from it. First of all, you need to go to admin->Header Tags->Fill Tags, click on the Fill All for both columns and click update. By doing that alone, all of your products and categories will be properly optimized for the SE's and those pages should begin to show up in the listings in good positions, depending upon the subject of course. You then need to go to admin->Header Tags->Text Control and change all of the displayed text to something that matches your site and uses your keyword. If you haven't chosen your keyword properly, then nothing you do will help your site and you need to concentrate on that.

 

Jack


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

Share this post


Link to post
Share on other sites

Thanks Jack, am I correct to assume that the item name should show in the top browser bar?

 

I beleive I have it all set up properly now, with keywords, meta tags and whatnot. But I am still not seeing anything populate for product_info.php besides the default (What I put in for the defaults at the top of 'header_tags_english.php'

 

under product_info (on the same settings page) I have left them blank, it seems like anything I put in there comes up for all the product pages. Im still wondering if I am correct in thinking the product info pages should show info from the actual product.

 

I have set all the tags, and after looking in the admin side of site - all 3000+ products look like they are populated correctly automatically with the product name.

Share this post


Link to post
Share on other sites
When you remove a page with the tool in admin like that, it eraes the entry from the header tags files in the shop. The product_info page is a special page and cannot just be added back in that way, You need to copy the code for it from the includes/header_tags.php file in the contribution. Don't just copy the whole file though or you will erase all of your other changes, unless there haven't been any.

 

Jack

 

 

I think this is my problem aswell. see the post above.

 

Yep, that was definitely my problem aswell, thanks for posting that info!

 

I think I am done now, WOW. The index, category and product pages show the right info. That was the hardest contrib I have installed and I have done A LOT of contribs to my site (most of which I probably just broke LOL)

Share this post


Link to post
Share on other sites

Jack,

 

Obviously the little fix I posted was flawed thinking that it would fix for all. The only solution to this working in both the default installation and having the admin directory in locations other than default is to use an absolute path like such:

 

DIR_FS_DOCUMENT_ROOT.DIR_WS_CATALOG.DIR_WS_LANGUAGES.$language.'/header_tags.php';

 

instead of the current method of relative path:

 

'../' . DIR_WS_LANGUAGES . $language . '/header_tags.php';

 

Was there a reason you didn't do it this way? (I did finally find your little note about this in the install (doah))

 

Todd

Share this post


Link to post
Share on other sites

No reason other than I didn't think about it. The way I used is the standard way of doing it and I just did it out of habit. Have you tried your method? I'm not sure it wil give a correct path (although it may work) due to the way slashes are added.

 

Jack


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

Share this post


Link to post
Share on other sites

Hi, everything works great under the "Header Tag" Column, thus I'm having a problem to log in to "Category". I received a "PARSE ERROR" message. Pls. see it listed below and please help me to correct it. Thank you. Kady

 

Parse error: parse error, unexpected T_CASE in /home/julielan/public_html/admin/categories.php on line 1032

Share this post


Link to post
Share on other sites
Hi, everything works great under the "Header Tag" Column, thus I'm having a problem to log in to "Category". I received a "PARSE ERROR" message. Pls. see it listed below and please help me to correct it. Thank you. Kady

 

Parse error: parse error, unexpected T_CASE in /home/julielan/public_html/admin/categories.php on line 1032

 

 

It's most likely a small goof in making the additions there. Recheck your Header Tags Controller additions around line number 1032 in the admin/categories.php file. Verify against the similar lines in this contribution's file catalog_for_new_shop_only/admin/categories.php. (not necesarily the same line number if you have other contributions installed)

Share this post


Link to post
Share on other sites

i have deleted some code where i think i added in the wrong place and now the following error appears:

 

Parse error: parse error, unexpected $ in /catalog2/admin/categories.php on line 1137

Share this post


Link to post
Share on other sites
i have deleted some code where i think i added in the wrong place and now the following error appears:

 

Parse error: parse error, unexpected $ in /catalog2/admin/categories.php on line 1137

 

Like julielan above, it's most likely a goof in adding the HTC code to your /catalog2/admin/categories.php near or above line 1137. compare with like lines in the contrib's catalog_for_new_shop_only/admin/categories.php file. (not necesarily the same line number if you have other contributions installed)

Share this post


Link to post
Share on other sites
No reason other than I didn't think about it. The way I used is the standard way of doing it and I just did it out of habit. Have you tried your method? I'm not sure it wil give a correct path (although it may work) due to the way slashes are added.

 

Jack

 

Looks like it does work. At least with a RHE 3 apache 1.3.34 PHP 4.3.11 server. Besides the tests, I echoed the combination and it's building the right path.

 

The main reason I was asking was to see if you had posibly run into a server that didn't get the right value for $DOCUMENT_ROOT global, which is used in the default osC install to get DIR_FS_DOCUMENT_ROOT. Fantastico doesn't use that global to define the DIR_FS_DOCUMENT_ROOT. They hard code the path, incorectly I might add. Which made me think maybe they and you had run into a situation in which the global $DOCUMENT_ROOT doesn't work right.

 

I have tried it with a default install of osC and a version I have that has the /admin/ outside the catalog directory. I also looked at the default install for Fantastico. They incorrectly add a trailing slash in the DIR_FS_DOCUMENT_ROOT constant.

 

Because of that, I checked it with DIR_FS_CATALOG instead of the combo DIR_FS_DOCUMENT_ROOT.DIR_WS_CATALOG. That works in a copy-over install for the default osC, and with the admin in a location outsite of the catalog, and a fantastico installation. I think doing an aboslute path with DIR_FS_CATALOG would be the best route. I prefer to use the predefined absolute paths.

 

The only other issue I can think of at the moment is the difference between 'nix and win machines, but if you can get away with hardcoding '../' and '/header_tags.php' for an include, this shouldn't be an issue. Any comments on that?

 

So I suppose if you don't object, I'll try the DIR_FS_CATALOG constant instead of the relative path in the update I'm putting together.

 

I also found another little glitch while testing this. In the admin/header_tags_english.php file (Text Control from the menu), if you put an apostrophe in the text and save, then save again, and again, a number of forward slashes start to pile up in front of the apostrophe. This only happens in the "Default" group a the top of the page. All the others work just fine. I tracked it to lines 27-29 of the file. Those addslashes() shouldn't be there. If they are removed, the Default group works with apostrophes. The addslashes() were not being done to the rest of the input and looks like it was being taken care of elsewhere.

 

Can you confirm that those are extraneous? Or was there a reason they were added there and maybe something else should be done?

 

Todd

Share this post


Link to post
Share on other sites

I installed complete version 2.5.5 and now when I go to edit a product, at the bottom of the page I get the following error.

 

Fatal error: Call to undefined function: tep_get_products_head_title_tag() in /home/www/mysite.com/admin/categories.php on line 579

 

I also can't submit my product edit as a result. Any suggestions?


Contributions installed: Purchase without Account / STS/ All Products/ Header Tags Controller

Share this post


Link to post
Share on other sites
I installed complete version 2.5.5 and now when I go to edit a product, at the bottom of the page I get the following error.

 

Fatal error: Call to undefined function: tep_get_products_head_title_tag() in /home/www/mysite.com/admin/categories.php on line 579

 

I also can't submit my product edit as a result. Any suggestions?

I would guess you didn't do the instructions in the Install_Admin.TXT file that is in the contribution package. there are several functions that need to be entered into the admin/includes/functions/general.php file there.

Share this post


Link to post
Share on other sites

You'r right! I entered it in catalog/includes/functions/general as opposed to admin/includes/functions/general like the instructions directed. Thank you...

Edited by sarafina

Contributions installed: Purchase without Account / STS/ All Products/ Header Tags Controller

Share this post


Link to post
Share on other sites

Hi there

 

I'm quite new to OScommerce, but have a working shop. I decided to install this contribution and ran into a problem almost immediately!

 

I copied "database_setup.php" to the right place on my host, typed the file name in my browser, and it came up with an error (that I have now lost, but said something like "cannot redfine tep_ .... already defined in header.php" - sorry that's all I can remember.

 

When I try to run "database_setup.php" again, I get the following error

 

"Looks like Header Tags is already installed. Aborting..."

 

I don't know what to do next. Does anybody have any ideas?

 

Thanks!

 

Ben

Share this post


Link to post
Share on other sites

If you are getting that second message, then the database changes were at least partially installed. Without knowing the first error it is difficult to say what went wrong. What I suggest you do is to make the few changes mentioned in the Install_Catalog.txt file. Where it says to add the text to each file in the root, only make the change to the index file. Then take a look at your shop. If you get an error, then the database was not fully loaded. If it works (you should see the title change from what it was) then you should be all set to fihish the installation.

 

Jack


Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Need Help? See this thread and provide the information requested.

How to Upgrade to the latest version

Recommended SEO Addons

Share this post


Link to post
Share on other sites

Thanks. Can I just clarify what you mean?

 

When I look at Install_Catalog, I think you are saying that I should perform the step starting NEW FILES TO ADD:

 

Then perform the step starting MODIFICATIONS TO FILES:

 

Then perform the step starting: CHANGES TO ALL FILES:

 

And make the change in there ("Old Lines" --> "New Lines") only to index.php, in the root, then check to see if the title has changed on the shop.

 

Is that right?

 

Cheers

 

Ben

Share this post


Link to post
Share on other sites

I have made these changes, and the shop still loads OK. If I look at the properties of my home page, the title is now

 

Home Page - osCommerce :

 

I think this means that everything is OK and I should just continue the installation.

 

Is this right?

 

Many thanks

 

Ben

Share this post


Link to post
Share on other sites

Thanks Jack

 

I think I have almost completed the installation of this contribution by following the instructions in install_admin.

 

However when I get to the section in the instructions headed "Around line 872, find this code" - the code has been replaced by something slightly different to allow categories to be turned on and off:

 

// #################### Added Categorie Enable / Disable ##################
//	  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
	$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
// #################### End Added Categorie Enable / Disable ##################
} else {
// #################### Added Categorie Enable / Disable ##################
//	  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
// #################### End Added Categorie Enable / Disable ##################

 

Could you advise me on what the code that I replace this with should be now, so I can keep the ability to turn categories on and off? It would be much appreciated!

 

Many thanks

 

Ben

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  

×