Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Header Tags Controller for Admin MS 2.2


Farrukh

Recommended Posts

1 - The keywords are in the products_description table in the products_head_keywords_tag column.

4- That variable is only used for the index page when the home section is not being displayed. It allows the insertion of the header_tags tags when on those pages.

 

Jack

 

This field in products_description is where I have been looking all along, and the keywords are not being added to this field. It looks like fill_tags.php put keywords in this field, but none of the keywords I have added in admin -- header tags -- text control have been added to the field in products_description. I'm just grasping at straws, but could it be permission setting to update the database. I wouldn't thing this would be it because fill_tags apparently updated the field.

 

Any idea what I need to do?

 

Thanks.

Link to comment
Share on other sites

  • Replies 4.6k
  • Created
  • Last Reply

Top Posters In This Topic

1 - The keywords are in the products_description table in the products_head_keywords_tag column.

4- That variable is only used for the index page when the home section is not being displayed. It allows the insertion of the header_tags tags when on those pages.

 

Jack

 

This field in products_description is where I have been looking all along, and the keywords are not being added to this field. It looks like fill_tags.php put keywords in this field, but none of the keywords I have added in admin -- header tags -- text control have been added to the field in products_description. I'm just grasping at straws, but could it be permission setting to update the database. I wouldn't thing this would be it because fill_tags apparently updated the field.

 

Any idea what I need to do?

 

Thanks.

 

I think I may have found the problem -- I'm not sure. I looked in admin/header_tags.php and I found the following:

 

<td align="center"><?php echo (tep_image_submit('button_update.gif', IMAGE_UPDATE) ) . ' <a href="' . tep_href_link(FILENAME_SEO_ASSISTANT, '') .'">' . '</a>'; ?></td>

 

However, I've looked in filename.php (both to make sure) and I don't see this file defined anywhere and I don't see any reference to a SEO_Assistant file in the contribution instructions. Did I miss something?

 

Thanks.

Link to comment
Share on other sites

Oh yeah, that is a mistake. Actually, there are two. In admin/header_tags_controller and admin/header_tags_english, both have that. Change it to 'header_tags_controller.php' and 'header_tags_english' respectively. Also use the '' I show so that it looks like

     <td align="center"><?php echo (tep_image_submit('button_update.gif', IMAGE_UPDATE) ) . ' <a href="' . tep_href_link('header_tags_controller.php', '') .'">' . '</a>'; ?></td>

and

     <td align="center"><?php echo (tep_image_submit('button_update.gif', IMAGE_UPDATE) ) . ' <a href="' . tep_href_link('header_tags_english.php', '') .'">' . '</a>'; ?></td>

That will teach me to beware of the easy copy/paste.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Oh yeah, that is a mistake.  Actually, there are two. In admin/header_tags_controller and admin/header_tags_english, both have that. Change it to 'header_tags_controller.php' and 'header_tags_english' respectively. Also use the '' I show so that it looks like
 ? ? <td align="center"><?php echo (tep_image_submit('button_update.gif', IMAGE_UPDATE) ) . ' <a href="' . tep_href_link('header_tags_controller.php', '') .'">' . '</a>'; ?></td>

and

 ? ? <td align="center"><?php echo (tep_image_submit('button_update.gif', IMAGE_UPDATE) ) . ' <a href="' . tep_href_link('header_tags_english.php', '') .'">' . '</a>'; ?></td>

That will teach me to beware of the easy copy/paste. 

 

Jack

 

 

I made the changes, but the field is still not updating.

 

I sure would like to use this, but I can't . In the meantime, I guess I will go into phpAdmin and update the database field directly. I assume the field should have commas between keywords, i.e., keyword1 (,) keyword2.

 

??

 

Thanks.

Link to comment
Share on other sites

If it is not updating the database with your keywords, then something is wrong. You can manually edit them if you want but that won't fix the problem. I would be worried something else is not working either. If Header Tags isn't working properly then you are wasting your time and possibly causing damage to your site as far as search engine position is concerned. So you really should fix the problem IMO.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

If it is not updating the database with your keywords, then something is wrong. You can manually edit them if you want but that won't fix the problem. I would be worried something else is not working either. If Header Tags isn't working properly then you are wasting your time and possibly causing damage to your site as far as search engine position is concerned.  So you really should fix the problem IMO.

 

Jack

 

 

Okay, I guess I will try to start over with the installation of the header tags. I can't imagine what would be wrong, because from outward appearances everything seems to be working correctly. Just when you dealve further, you see problems.

 

The catalog.txt installation instructions say "Make changs in "README to operate.txt." I did not see any reference to operate.txt in any of the README files nor did I see operate.txt. I just assumed this was associated with an old instruction and no longer was needed. Do you know what this is in reference to?

 

I have a few other questions:

 

1) I shouldn't have to start over with the database, right? The fields have been added to the database, so there should be no need for me to start over with a clean database. ??

 

2) Can you explain what the fields in the database do in comparison to what the keywords, title, etc. entered in english/header_tags.php.

 

3) Assuming I get everything working correctly, do I need to resubmit to the search engines so they pick up new tags?

 

Thanks.

Link to comment
Share on other sites

You are correct. That reference to Operate.txt is left over from a previous version. I renamed the files a few versions back and missed that one. It's equivalent file is the Install_Catalog.txt file.

 

As long as you used the latest version (as opposed to a pre 4.0 version), you do not need to reload the database.

 

The database is used to store the tags for the categories and products. The english file is for the other pages like Contact Us and Privacy. The products already have a place in the database so it is easy to put the header tags there. But there is no entry for the privacy page, for example, so one would have to be created. Then, if a new page was added, another database entry would have to be created. It is just not a workable solution.

 

You can re-submit if you want - the SE's won't care. But if you are already indexed, they will find you just as fast without the submission.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I have no idea what is going on but I hope someone can help me. I installed the newest HeaderTag Controller and I hope this is the right thread for it. HeaderTags_V_2.4.6

 

Everything seems to be working correctly although i can't be sure because I can not access the header_tags_controller.php

 

I have reinstalled it several times, thinking I messed something up somewhere but it is the same every time so I don't think that is it.

 

I get this error.

Fatal error: Cannot redeclare changeswitch() (previously declared in c:\program files\easyphp1-8\www\admin\includes\functions\header_tags.php:12) in c:\program files\easyphp1-8\www\admin\includes\functions\header_tags.php on line 12

 

I have never seen it before and have no clue what to do about it. I have tried commenting out lines to see what happens but that just makes different errors. It is calling for the changeswitch in the fucntions/header.php, english/header_tags_english.php and admin/header_tags_english.php but the error only happens in the admin side.

 

Any help would be appreciated. =)

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

The changeswitch is a function declared in admin/includes/functions/header_tag.php. The error is saying that it is being declared more than once, which is not allowed. Try doing a search of the whole admin directory for

function ChangeSwitch(

You should only find it in one file. If so, then open that file and search within it. There should only be one function by that name.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The changeswitch is a function declared in admin/includes/functions/header_tag.php.  The error is saying that it is being declared more than once, which is not allowed.  Try doing a search of the whole admin directory for
function ChangeSwitch(

You should only find it in one file. If so, then open that file and search within it. There should only be one function by that name.

 

Jack

 

 

I searched the entire site and found it only in that one file, and it came up only once... here is the page, maybe someone can see if the page is wrong? I haven't touched the code in any way.

 

 

 

 

<?php
/*
 $Id: header_tags_controller.php,v 1.0 2005/04/08 22:50:52 hpdl Exp $
 Originally Created by: Jack York - http://www.oscommerce-solution.com
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
function ChangeSwitch($line, $arg)
{
 if (isset($arg))
  $line = str_replace("0", "1", $line);
 else  
  $line = str_replace("1", "0", $line);
  
 return $line; 
}

//returns true if line is a comment
function IsComment($line)
{   
 return ((strpos($line, "//") === 0) ? true : false);
}

function IsTitleSwitch($line)
{   
 if (strpos($line, "define('HTTA") === 0 && strpos($line, "define('HTTA_CAT") === FALSE)
   return true;
 else
   return false; 
}

function IsDescriptionSwitch($line)
{   
 return ((strpos($line, "define('HTDA") === 0) ? true : false);
}

function IsKeywordSwitch($line)
{   
 return ((strpos($line, "define('HTKA") === 0) ? true : false); 
}

function IsCatSwitch($line)
{   
 return ((strpos($line, "define('HTTA_CAT") === 0) ? true : false); 
}

function IsTitleTag($line)
{   
 return ((strpos($line, "define('HEAD_TITLE_TAG") === 0) ? true : false);  
}

function IsDescriptionTag($line)
{   
 return ((strpos($line, "define('HEAD_DESC_TAG") === 0) ? true : false);
}

function IsKeywordTag($line)
{   
 return ((strpos($line, "define('HEAD_KEY_TAG") === 0) ? true : false);
}

function FileNotUsingHeaderTags($file)
{
 $file = '../'.$file;
 $fp = file($file);
 for ($i = 0; $i < count($fp); ++$i)
 {
     if (strpos($fp[$i], "Header Tags Controller") !== FALSE)
       return false;
 }
 return true;
}

function GetArgument(&$line, $arg_new, $formActive)
{
 $arg = explode("'", $line);
 
 if ($formActive)
 {
   $line = ReplaceArg($line, $arg_new);
 }
 else
 {             
   for ($i = 4; $i < count($arg); ++$i)
   {
      if (strpos($arg[$i], ");") === FALSE)
        $arg[3] .= $arg[$i];
   }             
 
   $arg[3] = str_replace("\\", "'", $arg[3]);
 }

 return $arg[3];
}

function GetMainArgument(&$line, $arg, $arg2, $formActive)
{
 $def = explode("'", $line);
 for ($i = 3; $i < count($def); ++$i)
 {
   if (strpos($def[$i], ");") === FALSE)
   {
     $arg .= $def[$i];
   }  
 }
 $arg = str_replace("\\", "'",$arg);
 
 if ($formActive)
 {
    $arg = addslashes($arg);
    $line = str_replace($arg, $arg2, $line);
    $arg = $arg2;
 }  
 
 return $arg;  
}

function GetSectionName($line)
{
 $name = explode(" ", $line);
 $name[1] = trim($name[1]);
 $pos = strpos($name[1], '.');
 return (substr($name[1], 0, $pos)); 
}

function GetSwitchSetting($line)
{
 return ((strpos($line, "'0'") === FALSE) ? 1 : 0);     
}

function NotDuplicatePage($fp, $pagename)  //return false if the name entered is already present
{
 for ($idx = 0; $idx < count($fp); ++$idx)   
 {
    $section = GetSectionName($fp[$idx]);
    if (! empty($section))
    {
       if (strcasecmp($section, $pagename) === 0)
         return false;
    }     
 }
 return true;
}

function ReplaceArg($line, $arg)
{
 $parts = explode("'", $line);         //break apart the line   
 $parts[3] = $arg;                     //replace the argument  
 
 if (strpos($parts[3], "\\") === FALSE)
   $parts[3] = addslashes($parts[3]);  
  
 $parts = $parts[0] . "'" . $parts[1] . "'" . $parts[2] . "'" . $parts[3] . '\');' . "\n";
 return $parts; 
 return implode("'", $parts);          //put line back together
}

function TotalPages($filename)
{
 $ctr = 0;
 $findTitles = false;
 $fp = file($filename);  
     
 for ($idx = 0; $idx < count($fp); ++$idx)
 { 
   $line=$fp[$idx];

   if (strpos($line, "define('HEAD_TITLE_TAG_ALL','") !== FALSE)
     continue;
   else if (strpos($line, "define('HEAD_DESC_TAG_ALL") !== FALSE)
     continue;
   else if (strpos($line, "define('HEAD_KEY_TAG_ALL") !== FALSE)
   {
     $findTitles = true;  //enable next section
     continue;
   } 
   else if ($findTitles)
   {
     if (($pos = strpos($fp[$idx], '.php')) !== FALSE)
       $ctr++; 
   }
 }  
 return $ctr;
}

function WriteHeaderTagsFile($filename, $fp)
{
 if (!is_writable($filename)) 
 {
    if (!chmod($filename, 0666)) {
       echo "Cannot change the mode of file ($filename)";
       exit;
    }
 }
 $fpOut = fopen($filename, "w");

 if (!fpOut)
 {
    echo 'Failed to open file '.$filename;
    exit;
 }
      
 for ($idx = 0; $idx < count($fp); ++$idx)
   if (fwrite($fpOut, $fp[$idx]) === FALSE)
   {
      echo "Cannot write to file ($filename)";
      exit;
   } 
 fclose($fpOut);   
}
?>

 

Thank you for replying =)

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

The file looks OK. The code

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

should only be found in the admin/header_tags_controller.php and admin/header_tags_english.php filles. You can try changing the require in each of those files to require_once. This shouldn't be necessary but if it works...

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

You are correct. That reference to Operate.txt is left over from a previous version. I renamed the files a few versions back and missed that one. It's equivalent file is the Install_Catalog.txt file.

 

As long as you used the latest version (as opposed to a pre 4.0 version), you do not need to reload the database.

 

The database is used to store the tags for the categories and products. The english file is for the other pages like Contact Us and Privacy.  The products already have a place in the database so it is easy to put the header tags there. But there is no entry for the privacy page, for example, so one would have to be created.  Then, if a new page was added, another database entry would have to be created. It is just not a workable solution.

 

You can re-submit if you want - the SE's won't care. But if you are already indexed, they will find you just as fast without the submission.

 

Jack

 

 

Thank you very much for answering all of my questions. I will try installing the contribution again and hopefully this time all will be well.

 

I wonder if whatever is wrong has caused the problem I described in an earlier post (see below).

 

 

Should I have the following results after installing tags contribution:

 

I am unable to edit product in admin now (things such as price, quantity, description, etc.).  When I try to change product name, description, or any specifics that I used to be able to enter on that page, I cannot. When I try to, the edit results in a blank field. The only way I can edit this field is if I go into phpAdmin and run a query to update the field.

 

Is this the way it is supposed to work?

Thanks again for your timely responses.

Link to comment
Share on other sites

Just installed this contrib but have a problem:

 

in header_tags_english.php when i update Default Descriptions and RockShopDirect it doesn't update, ie i change it then click update but when i come back to it later its back to the standard 'osCommerce : What'''s New Here? - Hardware Software DVD Movies'

 

Please help - driving me crazy

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

Hi all

I have just updated Richard Fielder Admin mod to be compatible with Milestone 2.2. Its a simple update

let me know if anyone finds any problems.

Get it here:

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

 

 

Can you take a look at my site at www.clearimageproducts.com and let me know what you think regarding SEO. I know "next to nothing" about it, but I have installed the tags controller contribution, and tried to assign keywords, etc.

 

Also, what do you think about the site in general, not the product being sold because I have a lot to add and/or change as far as that is concerned, but the overall look of the site. Also, if you have any tools that you can suggest that I use to help me improve or diagnose the site, that would be helpful.

 

Any suggestions about SEO or general comments about the site would be greatly appreciated.

 

Thank you.

Link to comment
Share on other sites

Yes it does, is that a known fault or just on mine?

Cheers

Neither, or maybe both. All that indicates is that the problem is related to the admin section. It could be because the files in the catalog section are not write enabled. Try setting the permissions to 777 and trying it again. If it still fails, it could be that your host won't allow such writing to files. Although I would think you would get a warning message if that were the case. Is your admin directory located in the same place as your includes directory? If not, the code in the admin/header_tags files has to be edited to account for the different location.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Can you take a look at my site at www.clearimageproducts.com and let me know what you think regarding SEO.  I know "next to nothing" about it, but I have installed the tags controller contribution, and tried to assign keywords, etc. 

 

Also, what do you think about the site in general, not the product being sold because I have a lot to add and/or change as far as that is concerned, but the overall look of the site.  Also, if you have any tools that you can suggest that I use to help me improve or diagnose the site, that would be helpful.

 

Any suggestions about SEO or general comments about the site would be greatly appreciated. 

 

Thank you.

This is not the correct place to ask for a site review but I will give you a few quick thoughts. The title of the home page should be the keyword for the page. It is not. You don't have any useful information on the page for the SE's, or even people, to use. The SE's can't see images so one you remove that you only have a handle of words. They want to see hundreds. You nned to add a lot, and by that I mean a LOT, of information to the page before it will place anywhere in the listings. Also, your keyword is not something that is just picked because you think it is a good one. It needs to be researched through overture and/or wordtracker. Find out how many people are actually searching for oyur chosen keyword and make your decision based on that. I have no way of knowing if you have done this already so I am just throwing it out there. Read through the forums for tips about SEO. Also search the web for how to do it. It is one of the most popular subjects going so there are many sites that cover what is needed and how to do it.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I've just finished installing this contribution and it seems fine so far apart from one thing, when i click on update in the 'Header Tags - Text Control' in Admin i get the following message:

 

Warning: chmod(): Operation not permitted in /home/****/public_html/admin/includes/functions/header_tags.php on line 194

Cannot change the mode of file (../includes/languages/english/header_tags.php)

 

Any idea what needs changing?

Thanks in advance

Link to comment
Share on other sites

I've just finished installing this contribution and it seems fine so far apart from one thing, when i click on update in the 'Header Tags - Text Control' in Admin i get the following message:

Any idea what needs changing?

Thanks in advance

 

I would guess you need to change the permissions of the file. ie in an ftp program change the permissions to 777 or something.

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

I would guess you need to change the permissions of the file. ie in an ftp program change the permissions to 777 or something.

Thanks Lewis, would that be the /home/****/public_html/admin/includes/functions/header_tags.php file or the ../includes/languages/english/header_tags.php one?

 

Thanks again

Link to comment
Share on other sites

The includes/header_tags.php and includes/languages/english/header_tags.php files need to be changed. Some hosts won't allow a program to change the permissions so that it is why you are sesing the error.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The includes/header_tags.php and includes/languages/english/header_tags.php files need to be changed. Some hosts won't allow a program to change the permissions so that it is why you are sesing the error.

 

Jack

Thanks Jack, it works perfect now apart from i must have done something slightly wrong as i get my tags like as follows where my default title appears after the individual page title and the generic osCommerce tags appear after my ones in 'description' and 'keywords'. How can i fix this?

 

Thanks again for your help

 

<title>Black Mk2 Mini MotoWelcome to MiniMotosandMore</title>

  <META NAME="Description" Content="A great example of the black Mk2 Mini Moto at an affordable price osCommerce : What\'s New Here? - Hardware Software DVD Movies">

  <META NAME="Keywords" CONTENT="Black, Mini Moto, Minimoto, Pocket bike Hardware Software DVD Movies What\'s New Here?">

Link to comment
Share on other sites

Thanks Jack, it works perfect now apart from i must have done something slightly wrong as i get my tags like as follows where my default title appears after the individual page title and the generic osCommerce tags appear after my ones in 'description' and 'keywords'.  How can i fix this?

 

Thanks again for your help

 

I think you have to open the file up and change the default osC text, rather than using the admin side of the contribution.

 

HTH

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

Thanks Jack, it works perfect now apart from i must have done something slightly wrong as i get my tags like as follows where my default title appears after the individual page title and the generic osCommerce tags appear after my ones in 'description' and 'keywords'.  How can i fix this?

 

Thanks again for your help

The default title should appear after the individual page title for best SE results. If you want to change the order thougjh, read back in this thread for 2-3 pages. I explain how to do it there.

 

Jack

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

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