Results 1 to 7 of 7

Category description in meta tags?

This is a discussion on Category description in meta tags? within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; Ok I have searched the forum to death, but cannot find any answer to this. Is there anyway to have ...

      
  1. #1
    New Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0


    Default Category description in meta tags?

    Ok I have searched the forum to death, but cannot find any answer to this.

    Is there anyway to have the dynamic meta tags create description tags for the Category pages aswell?

  2. #2
    New Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0


    Default Re: Category description in meta tags?

    Ok so i'm now a bit chuffed with myself to finding the solution

    However I still need a bit of help stripping the html out of the category description which shows up in the meta tags.

    So heres my modified code for meta_tags.php

    PHP Code:
    case CONTENT_INDEX_PRODUCTS:
        if (isset(
    $HTTP_GET_VARS['manufacturers_id'])) {
       
    $mt_manufacturer_query tep_db_query("select manufacturers_name from " TABLE_MANUFACTURERS " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
          
    $mt_manufacturer tep_db_fetch_array($mt_manufacturer_query);
       
    define('META_TAG_TITLE'$mt_manufacturer['manufacturers_name'] . PRIMARY_SECTION TITLE $web_site_tagline);
       
    define('META_TAG_DESCRIPTION'TITLE PRIMARY_SECTION $mt_manufacturer['manufacturers_name']) . SECONDARY_SECTION WEB_SITE_KEYWORDS;
       
    define('META_TAG_KEYWORDS'WEB_SITE_KEYWORDS $mt_manufacturer['manufacturers_name']);
     } else {
          
    $mt_category_query tep_db_query ("select categories_name, categories_description, categories_heading_title from " TABLE_CATEGORIES_DESCRIPTION " where categories_id = '" . (int)$current_category_id "' and language_id = '" . (int)$languages_id "'");
          
    $mt_category tep_db_fetch_array($mt_category_query);
       
    define('META_TAG_TITLE'$mt_category['categories_name'] . PRIMARY_SECTION TITLE $web_site_tagline);
       
    define('META_TAG_DESCRIPTION'TITLE PRIMARY_SECTION $mt_category['categories_description']) . SECONDARY_SECTION WEB_SITE_KEYWORDS;
       
    define('META_TAG_KEYWORDS'WEB_SITE_KEYWORDS $mt_category['categories_name']);
        }
        break; 
    I have tried the following for stripping out the html

    PHP Code:
    $mt_categories_description substr(strip_tags(stripslashes($mt_categories_description['categories_description'])), 0100); 
    and

    PHP Code:
    $mt_categories substr(strip_tags(stripslashes($mt_categories_description['categories_description'])), 0100); 
    and
    PHP Code:
    $mt_categories_description TABLE_CATEGORIES_DESCRIPTION strip_tags($mt_categories_description); 
    But none seem to work.

    Can anybody help me with this last bit?
    Pretty please?
    With sugar on top?

  3. #3
    New Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0


    Default Re: Category description in meta tags?

    Ok this is now sorted

    Feel free to close the thread!

  4. #4
    New Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0


    Default Re: Category description in meta tags?

    Could you please share your solution?
    Thanks

  5. #5
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,501
    Rep Power
    567


    Default Re: Category description in meta tags?

    We don't close threads unless they are over a year old.

    I am sure there are others that would benefit from your work on this, so in the spirit of open source, how about sharing your solution? After all, I shared my work with you (osCMax!)
    Michael Sasek
    osCMax Developer


    osCmax installation service - Have our professionals install osCmax on your server - same day service!
    osCmax 2.0 User Manual - the must have beginners guide to osCmax v2.0

    Stay Up To Date with everything osCMax:
    Free osCMax Newsletters - Security notices, New Releases, osCMax News
    osCMax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  6. #6
    New Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0


    Default Re: Category description in meta tags?

    I dont have a problem with sharing my work, but due to the lack of responses, and the fact this has never been asked before I assumed this was of no interest to anybody.

    I'm no PHP expert, in fact more of a novice in every sense, but it was very easy to work out what needed doing by looking at the CONTENT_PRODUCT_INFO part of the meta_tag.php file.

    Anyway, for those that do want good SEO, follow these instructions.

    Open catalog/includes/meta_tags.php

    Find

    PHP Code:
    case CONTENT_INDEX_PRODUCTS:
    if (isset(
    $HTTP_GET_VARS['manufacturers_id'])) {
    $mt_manufacturer_query tep_db_query("select manufacturers_name from " TABLE_MANUFACTURERS " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
    $mt_manufacturer tep_db_fetch_array($mt_manufacturer_query);
    define('META_TAG_TITLE'$mt_manufacturer['manufacturers_name'] . PRIMARY_SECTION TITLE $web_site_tagline);
    define('META_TAG_DESCRIPTION'TITLE PRIMARY_SECTION $mt_manufacturer['manufacturers_name']) . SECONDARY_SECTION WEB_SITE_KEYWORDS;
    define('META_TAG_KEYWORDS'WEB_SITE_KEYWORDS $mt_manufacturer['manufacturers_name']);
    } else {
    $mt_category_query tep_db_query("select categories_name from " TABLE_CATEGORIES_DESCRIPTION " where categories_id = '" . (int)$current_category_id "' and language_id = '" . (int)$languages_id "'");
    $mt_category tep_db_fetch_array($mt_category_query);
    define('META_TAG_TITLE'$mt_category['categories_name'] . PRIMARY_SECTION TITLE $web_site_tagline);
    define('META_TAG_DESCRIPTION'TITLE PRIMARY_SECTION $mt_category['categories_name']) . SECONDARY_SECTION WEB_SITE_KEYWORDS;
    define('META_TAG_KEYWORDS'WEB_SITE_KEYWORDS $mt_category['categories_name']);
    }
    break; 
    and replace with

    PHP Code:
    case CONTENT_INDEX_PRODUCTS:
    if (isset(
    $HTTP_GET_VARS['manufacturers_id'])) {
    $mt_manufacturer_query tep_db_query("select manufacturers_name from " TABLE_MANUFACTURERS " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
    $mt_manufacturer tep_db_fetch_array($mt_manufacturer_query);
    define('META_TAG_TITLE'$mt_manufacturer['manufacturers_name'] . PRIMARY_SECTION TITLE $web_site_tagline);
    define('META_TAG_DESCRIPTION'TITLE PRIMARY_SECTION $mt_manufacturer['manufacturers_name']) . SECONDARY_SECTION WEB_SITE_KEYWORDS;
    define('META_TAG_KEYWORDS'WEB_SITE_KEYWORDS $mt_manufacturer['manufacturers_name']);
    } else {
    $mt_category_query tep_db_query ("select categories_name, categories_description, categories_heading_title from " TABLE_CATEGORIES_DESCRIPTION " where categories_id = '" . (int)$current_category_id "' and language_id = '" . (int)$languages_id "'");
    $mt_category tep_db_fetch_array($mt_category_query);
    $mt_categories_description substr(strip_tags(stripslashes($mt_category['categories_description'])), 0150);
    define('META_TAG_TITLE'$mt_category['categories_name'] . PRIMARY_SECTION TITLE $web_site_tagline);
    define('META_TAG_DESCRIPTION'PRIMARY_SECTION $mt_categories_description '...') . SECONDARY_SECTION WEB_SITE_KEYWORDS;
    define('META_TAG_KEYWORDS'WEB_SITE_KEYWORDS);
    }
    break; 
    If you want your category meta description longer or shorter change the value of 150 in the new code,to the number of characters you would like generated.
    Last edited by Interceptor; 01-12-2008 at 11:32 PM.

  7. #7
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,501
    Rep Power
    567


    Default Re: Category description in meta tags?

    We have a ton of lurkers, so there is always interest even if nobody has an answer for you. Also, someone may come along weeks, months or years later, long after this thread is closed. Your post will help hundreds or thousands of osCMax users over the lifetime of the site. You should always share the solution, it is just the cool thing to do

    Pretty cool that three years from now, somebody may read your post, and you help them solve their problem without even knowing it. That is the gift that keeps on giving!
    Michael Sasek
    osCMax Developer


    osCmax installation service - Have our professionals install osCmax on your server - same day service!
    osCmax 2.0 User Manual - the must have beginners guide to osCmax v2.0

    Stay Up To Date with everything osCMax:
    Free osCMax Newsletters - Security notices, New Releases, osCMax News
    osCMax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

Similar Threads

  1. Easy Meta Tags - CUSTOM Product Tags for STS v4
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 11-26-2007, 05:14 PM
  2. Category Meta Tags
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 04-13-2007, 12:00 PM
  3. Category Meta Tags
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 03-18-2007, 06:12 AM
  4. meta tags, web site description advice?
    By lil-raskals in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 09-24-2004, 11:35 AM
  5. Meta Tags
    By DiamondC in forum osCommerce 2.2 Modification Help
    Replies: 2
    Last Post: 01-20-2004, 02:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •