Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Categories description text -- simple method


Recommended Posts

Instead of altering meta tags for the categories, I thought of a SIMPLE way to add category-specific text to each category page. (Yes, I know this can be accomplished through the categories description contrib, too!)


How simple is it?

-I edited only ONE page: catalog/default.php

-And I made only ONE change to the database.

-However, I don't have the php knowledge to write an admin mod -- sorry! Perhaps someone else who knows how could add that to admin/categories.php under the edit-categories action?


Since this is so simple, I hope no one minds my adding it here, instead of as a contrib.



In default.php, find the <tr> which contains your category heading title and then the category image, and add this new row beneath that row. I have modified my file too much to point to exact code, but it should be just a few lines ABOVE this: <?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING_COL); ?> Add this row INSIDE the table that ends just above the this line and the separator line above it.





<!-- this row holds the categories_text description -->


<td colspan=2 class="main">


function tep_get_category_text($category_id) {

global $languages_id;


$category_query = tep_db_query("select categories_text from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $languages_id . "'");

$category = tep_db_fetch_array($category_query);


return $category['categories_text'];



echo tep_get_category_text($current_category_id);




<!-- end of categories_text row -->





Run this query on your database:



ALTER TABLE `categories_description` ADD `categories_text` TEXT DEFAULT NULL ;


ALTER TABLE `categories_description` ADD FULLTEXT (





That's it! This will make the categories_text appear just below the name of your category. As I said, there is no admin mod, so you have to do it all directly through the database right now. I was toying around with an admin mod, but don't know how to add it to admin/categories.php. Anywhere else, the query line would be something like:


UPDATE `categories_description` SET `categories_text` = ' <<add text here >> ' WHERE `categories_id` = ' <<use $current_category_id variable>> ' AND `language_id` = ' <<use $current_language_id variable >> ' LIMIT 1 ;



Well, that's it! I hope someone will find it useful, and maybe we'll see an admin mod someday.




Link to comment
Share on other sites


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

  • Create New...