Jump to content
Sign in to follow this  
winterradio

Category Specific Meta Tags

Recommended Posts

Alright guys, here's how I integrated the three Add-Ons. This might not be the best way to do it, but here goes:

 

else {

 

  if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

    require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');

    require(DIR_WS_FUNCTIONS . 'header_tags.php');

    require(DIR_WS_INCLUDES . 'header_tags.php');

    }

}

 

I added Linda's call to the meta_tags.php at the bottom of the file just above the last section of code:

 

echo '<title>' . $meta_title . '</title>' . "\n";

echo '<meta name="keywords" content="' . $meta_keywords . '">' . "\n";

echo '<meta name="description" content="' . $meta_description . '">' . "\n";

 

So, if you are using the Simple Template System and want to include both header tag add-ons, this is one way to go. I hope this helps someone.

Share this post


Link to post
Share on other sites

Well, I noticed a bug in the code and it was only displaying for tags for one of the options. So, here is the fix. First, I moved a couple of Linda's calls up top:

 

<?php

? ? require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');

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

////////////////////////////

// User Definable Section //

////////////////////////////

 

Then I added some "else if" statements in there:

 

// Category Results Meta - start

if (isset($cPath) && tep_not_null($cPath)) {

 

$metaCategoryArray = explode ("_",$cPath);

if (strpos($cPath, '_')) { $metaCategoryArray? = array_reverse($metaCategoryArray); }

$metaCategory = $metaCategoryArray[0];

?

$category_query = tep_db_query ("select title, keywords, description from " . TABLE_METATAGS . " where categories_id = '" . $metaCategory . "'");

 

$metaData = tep_db_fetch_array ($category_query);

 

if ($metaData ['title']) $meta_title = $common_meta_title . " " . $metaData ['title'];

if ($metaData ['keywords']) $meta_keywords = $metaData ['keywords'] . ", " . $common_meta_keywords;

if ($metaData ['description']) $meta_description = $metaData ['description'] . " " . $common_meta_description;

 

}

// Category Results Meta - end

 

// Manufacturers Results Meta - start

else if (isset($manufacturers_id) && tep_not_null($manufacturers_id)) {

 

$manufacturers_query = tep_db_query ("select title, keywords, description from " . TABLE_METATAGS . " where manufacturers_id = '" . $manufacturers_id . "'");

 

$metaData = tep_db_fetch_array ($manufacturers_query);

 

if ($metaData ['title']) $meta_title = $common_meta_title . " " . $metaData ['title'];

if ($metaData ['keywords']) $meta_keywords = $metaData ['keywords'] . ", " . $common_meta_keywords;

if ($metaData ['description']) $meta_description = $metaData ['description'] . " " . $common_meta_description;

 

}

// Manufacturers Results Meta - end

 

// Keyword Search Results Meta - start

else if (isset($keywords) && tep_not_null($keywords)) {

 

$searchword_query = tep_db_query ("select title, keywords, description from " . TABLE_METATAGS . " where searchword = '" . $keywords . "'");

 

$metaData = tep_db_fetch_array ($searchword_query);

 

if ($metaData ['title']) $meta_title = $common_meta_title . " " . $metaData ['title'];

if ($metaData ['keywords']) $meta_keywords = $metaData ['keywords'] . ", " . $common_meta_keywords;

if ($metaData ['description']) $meta_description = $metaData ['description'] . " " . $common_meta_description;

 

}

// Keyword Search Results Meta - end

 

// INDIVIDUAL PRODUCTS

else {

? ? require(DIR_WS_INCLUDES . 'header_tags.php');

? ? }

// INDIVIDUAL PRODUCTS

 

echo '<title>' . $meta_title . '</title>' . "\n";

echo '<meta name="keywords" content="' . $meta_keywords . '">' . "\n";

echo '<meta name="description" content="' . $meta_description . '">' . "\n";

 

?>

 

This also includes an option that will define the tags based on a keyword search. We use advanced search links to create results pages on our site and we want Google to see those as distinct pages...so, we added field to the database called "searchword" and inserted tags for the particular keywords we use.

 

Again, I'm no whiz at this stuff as I've pretty much taught myself PHP by modifying osCommerce. Therefore, I always think there's a "proper" way to do things. But, this worked for me so, I post it to hopefully help someone else out.

Edited by adorableannouncements.com

Share this post


Link to post
Share on other sites

Hi,

 

i had install the Meta Tags V3.0 and get every time the same error,

 

i verify the installation 3 times and did all steps right but the error dont goes away.

 

MY ERROR IS:

 

1146 - Table 'db106192781.TABLE_METATAGS' doesn't exist

 

delete from TABLE_METATAGS where categories_id = '25'

 

[TEP STOP]

 

 

in the admin file i have the meta_tags table an it look like this:

 

Database xxxxxx - Table meta_tags running on xxxxxx.com

  Structure

    Browse    SQL

    Search    Insert

    Export

    Operations

    Empty    Drop

   

 

 

      Field  Type Attributes Null Default Extra Action

  meta_id  int(11)  No    auto_increment             

  categories_id  int(11)  Yes  0               

  manufacturers_id  int(11)  Yes  0               

  keywords  varchar(255)  No                 

  description  varchar(255)  No                 

  title  varchar(255)  No                 

Check All  /  Uncheck All    With selected:     

 

 

 

    Indexes : [Documentation]

Keyname Type Cardinality Action Field

PRIMARY  PRIMARY  0      meta_id 

keywords  FULLTEXT  None      keywords 

keywords_2  FULLTEXT  None      keywords 

 

Create an index on  columns      Space usage : Type Usage

Data 0 Bytes

Index 1,024 Bytes

Total 1,024 Bytes

  Row Statistic : Statements Value

Format dynamic 

Rows 0 

Next Autoindex 1 

Creation Aug 08, 2004 at 01:05 AM 

Last update Aug 08, 2004 

 

any help please

 

for beginners

thanks a lot

Share this post


Link to post
Share on other sites

Hi Martin,

 

Looks like you are not adding the line to the databse_tables file (item 6 of install instructions).

 

 

 

6) In the following files:

 

/catalog/includes/database_tables.php

/catalog/admin/includes/database_tables.php

 

Add:

 

// RJW Begin Meta Tags Code

define('TABLE_METATAGS', 'meta_tags');

// RJW End Meta Tags Code

 

 

Cheers

Rob

Share this post


Link to post
Share on other sites
Hi Martin,

 

Looks like you are not adding the line to the databse_tables file (item 6 of install instructions).

 

 

 

6) In the following files:

 

/catalog/includes/database_tables.php

/catalog/admin/includes/database_tables.php

 

Add:

 

// RJW Begin Meta Tags Code

define('TABLE_METATAGS', 'meta_tags');

// RJW End Meta Tags Code

 

 

Cheers

Rob

I am getting the same error and I have completed part 6 perfectly...

 

A little odd...

 

Anything else that could be creating that error?

Share this post


Link to post
Share on other sites

I also have the same error. I am using STS. Here is the error:

 

1146 - Table 'dcgtest2_osc3.TABLE_META_TAGS' doesn't exist

 

select title, keywords, description from TABLE_META_TAGS where categories_id = '4'

 

TIA.


Learning is not attained by chance, it must be sought for with ardor and attended to with diligence.

Share this post


Link to post
Share on other sites

Me too! Can't see what the problem is and I have no idea about SQL though I seem to have managed to create the table ok using phpmyadmin.

Share this post


Link to post
Share on other sites

Well, at least we know we aren't alone!


Learning is not attained by chance, it must be sought for with ardor and attended to with diligence.

Share this post


Link to post
Share on other sites

I've just cured my problem - the underscore was missin the database_tables.php file

// RJW Begin Meta Tags Code

define('TABLE_META_TAGS', 'meta_tags');

// RJW End Meta Tags Code

 

Popped the underscore in..it works fine now.

Share this post


Link to post
Share on other sites

Help! I just tried to install this contrib and am getting the following error in both my website and my admin:

 

1146 - Table 'blowinin_cart1.TABLE_CONFIGURATION' doesn't exist

 

select configuration_key as cfgKey, configuration_value as cfgValue from TABLE_CONFIGURATION

 

[TEP STOP]

 

 

My site is live! Any help is much appreciated!!

 

Billie

Share this post


Link to post
Share on other sites

Billie,

 

Check your database tables files:

 

/catalog/includes/database_tables.php

/catalog/admin/includes/database_tables.php

 

It sounds like you have deleted the line which reads:

 

define('TABLE_CONFIGURATION', 'configuration');

 

You do have a backup, right... ;-)

 

 

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

 

Miop et al,

 

I don't know where you got the TABLE_META_TAGS bit / error from - all references in my original 3.01 contribution refer correctly to TABLE_METATAGS. Perhaps another modification (STS/Lindas Header tags?) introduces this other variable and you are messing up the other contrib? I don't know. However, the 19th April 3.0.1 version has been tested and works perfectly with a clean MS2.2 install ...

 

Cheers

Rob

Share this post


Link to post
Share on other sites

actually, it was surpisingly enough the typo problem causing that same error...it being written as metatags instead of meta_tags! I do have another question tho...I obviously installed this on a live store and want to add the metatags to my current catagories, but I'm not seeing how I can do that. When I go to my catalog in admin there's no where to add it to my current categories, but if I set up a new category, the boxes are all there to add the tags. Am I missing something or do I just need to create all new categories and just move my products over to the new ones?

Share this post


Link to post
Share on other sites

Rob, I was using the version 3.00 which for some reason is listed higher than 3.01 in the contributions section - maybe that's the problem? Definitely working now though!

Great contribution by the way...excellent!

Share this post


Link to post
Share on other sites

Hi Billie,

 

Sounds like you didn't add every block of code - check through your version and the one in the package - there shoud be five code chunks in admin/categoiries.php, each demarked with // RJW Begin Meta Tags Code

 

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

 

Hi Miop,

 

Thanks :)

 

I just compared my 19th April 3.01 verison to the latest (at the moment) 22nd August 3.0a version by Insomniac, and the only differences are:

  • The name of the Meta Tags table variable (was TABLE_METATAGS, now TABLE_META_TAGS). I'm not sure why this change was needed, unless for cosmetic reasons, or perhaps a similar variable was defined with STS contribution causing a confilct...? Maybe Keri or Keith could shed some light on why this was necesary.
     
  • There is a new file containing the additions needed in english.php - which were previously listed in the Install file

So in theory, you should be able to use either version as they will work the same.

 

Cheers

Rob

Share this post


Link to post
Share on other sites

I having a similar problem to you guys.

 

Can someone tell me where i can find the code in the files to change the sql database name, its looking for

 

1146 - Table 'swift_oscom.meta_tags' doesn't exist

 

select title, keywords, description from meta_tags where categories_id = '240'

 

but my php admin wont let me have a name like that?

 

Thanks

 

Michael

Share this post


Link to post
Share on other sites

I am getting this message wen i want to click on my categories:

 

1146 - Table 'andrewbo_osc1.meta_tags' doesn't exist

 

select title, keywords, description from meta_tags where categories_id = '29'

 

[TEP STOP]

 

I am not sure how i do this 1st step, by not doing this would it lead to that message appearing when i click on a category.

 

1) Run the meta_tags.sql in phpmyadmin to create the meta_tag table

Share this post


Link to post
Share on other sites
I am getting this message wen i want to click on my categories:

 

1146 - Table 'andrewbo_osc1.meta_tags' doesn't exist

 

select title, keywords, description from meta_tags where categories_id = '29'

 

[TEP STOP]

 

I am not sure how i do this 1st step, by not doing this would it lead to that message appearing when i click on a category.

 

1) Run the meta_tags.sql in phpmyadmin to create the meta_tag table

 

Andrew - yes, step one creates the table in your database, so if you don't do it, you would get this error. Best thing to do is to contact your web host and ask them how you can run the meta_tags.sql file. In phpmyadmin, you simply click on your database, go to the SQL tab, and then select the file to run it.

 

Michael - You probably figured it out after nearly a year, but just for completeness... I suspect that you were trying to add a table called 'swift_oscom.meta_tags', which would not be valid. Solution - don't try to create the table manually, just run the meta_tags.sql file, and it will do it properly for you. The error is telling you that the table 'meta_tags' is missing from the database 'swift_oscom'. The table name is just 'meta_tags' (which is a valid name).

 

Cheers

Rob

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  

×