Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy meta tags?


rstn123

Recommended Posts

I've implemented 'dynamic' Meta Tags by using the title of the products and the description of the product.

 

In product_info.php find:

 

$location = ''; (its about line 17)

 

Directly after it add:

 

if (isset($products_id)) {

   $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");

   $product_info_values = tep_db_fetch_array($product_info);



   $keywords = strip_tags($product_info_values['products_description']);

   $keywords = substr($keywords, 0, 250);

}

 

Find the <title> </title> line and replace it with:

 

<title><?php echo TITLE; ?> | <?php echo $product_info_values['products_name']; ?></title>

 

Directly after your new title line, add:

 

<meta name="keywords" content="<?php echo $product_info_values['products_name']; ?> | <?php echo TITLE; ?>">

<meta name="description" content="<?php echo $keywords; ?>">

 

No work, and a good solution. All you have to do is make sure you give your product a good descriptive name, and a great description...

Link to comment
Share on other sites

I get tricky like that on code just to scare you ... :shock:

 

It's really not all that horrible just a lot of methods to set up the various tags for each page.

 

You can also add additional case statements to setup other tag settings as needed for your site.

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

I've installed Lindas contribution (It was easier than I thought) I haven't changed all of the 30+ files yet.

 

when I move to checkout from the cart I receive this message:

 

Warning: Cannot add header information - headers already sent by (output started at /usr/local/plesk/apache/vhosts/talespinners.ca/httpdocs/catalog/includes/functions/header_tags.php:11) in /usr/local/plesk/apache/vhosts/talespinners.ca/httpdocs/catalog/includes/functions/general.php on line 23

 

 

What's wrong?

Link to comment
Share on other sites

Check the two filenames mentioned in your error msg for spaces or blank likes before or after the <?php and ?>

 

I found a couple spaces this morning in a language file general.php was calling from.

 

The name was plain as day in the error message. But did I look at the language file? No of course not ... :shock:

 

I did 20 minutes later for giggles ... and dang if there weren't two spaces beneath the last ?> in that file. :roll:

 

Took out the spaces ... and the miracle occured! :listen:

Link to comment
Share on other sites

I've checked all of the 4 files that come with the mod and removed the extra space on the bottom of the files. I still get the same message (I verified that it's the same message).

 

Thanks again for your help Linda

Link to comment
Share on other sites

Round two ... check the tops of the files before the <?php

 

And sometimes a blank like near the top below a

 

<?php

// blah blah blah

?>



<?php

 // more blah, blah, blah



?>

 

Will break it.

 

Also if you know the ones on your computer are nice and clean, delete them on the server and reload them.

Link to comment
Share on other sites

Results of round 2:

 

Found one instance of the space above the <?p and fixed it. Same message :x

 

I always refresh the files on the server when I change them so I didn't bother trying that again.

 

Once again "for giggles" I removed the header file mentioned above and the reference to in in application_top and the error message didn't reappear. Although I'm no php programmer, the programmer in me says the problem's there. What do you think?

Link to comment
Share on other sites

Sorry about that,

 

1. I deleted catalog/includes/functions/header_tags.php from the server.

 

2. Commented out the lined in application_top that read:

require(DIR_WS_FUNCTIONS . 'header_tags.php');

 

Now that I think about it the first step was uneccessary but oh well...

 

After I did that I hit the checkout button from the cart and it worked as it should.

Link to comment
Share on other sites

  • 1 year later...
  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...