Book Image

Deep Inside osCommerce: The Cookbook

By : Monika Mathe
Book Image

Deep Inside osCommerce: The Cookbook

By: Monika Mathe

Overview of this book

osCommerce has been around since March 2000. At present there are over 10,000 live, registered osCommerce sites, and about 100,000 registered community members. Apart from providing ready-made solutions to problems, as well as a huge repository of information, the osCommerce community is a living entity with which we can all interact. With the rising success and popularity of this remarkable piece of software, things can only get better.
Table of Contents (17 chapters)
Deep Inside osCommerce: The Cookbook
Credits
Foreword
About the Author
About the Reviewers
Introduction

18. Add Top Category in Product Listing


This recipe displays the top category along with the product name in product listing. This is a great alternative to the recipe shown before, especially when you have deeper category structures and want the category name to make clear which section each product belongs to. It is also a great help when you have products with the same name in different categories (and not being created as one product with different attributes), like movies offered in VHS and DVD format.

Presentation

Your screen will look like this with the top category of each product added before the product name:

Ready to try a roast alternative? Let's prime the rib!

Ingredients

Note

Modified:

catalog/includes/functions/general.php

catalog/includes/modules/product_listing.php

Cooking

  1. 1. Open catalog/includes/functions/general.php and add this function directly before the closing ?> PHP tag to get the top-category name for a given product:

function tep_get_category_name($product_id...