Main Contents

Replace “Let’s See What we Have Here” with category names

April 23, 2008

Standard osCommerce has an odd ‘Let’s See What we Have Here Then’ message at the top of each of the category pages. See the osCommerce demo site to see what I mean. You can replace these messages easily with the following snippets of code:

Find and replace the 3 occurences of the following line on index.php:

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

With:

<td class="pageHeading"><?php echo tep_get_categories_name($current_category_id); ?></td>

And then add this function to the bottom of includes/functions/general.php, before the last ?>


//
// get the categories name given the path
// by www.oscommerce-uk.co.uk

function tep_get_categories_name($cat_id) {
    global $languages_id;

    if ($cat_id != 0) {

        $category_name_query = tep_db_query("SELECT categories_name FROM "
        . TABLE_CATEGORIES_DESCRIPTION . " where categories_id='" . (int) $cat_id . "'
        AND     language_id='$languages_id'");

        $category_name = tep_db_fetch_array($category_name_query);
        return $category_name['categories_name'];
    } else {
        return HEADING_TITLE;
    }
}

That’s it - done!

See the finished result here:

Let’s See What We Have Here replaced with category names

Filed under: osCommerce modifications |

Leave a comment