Contributions

Other (Category Index)
Search: 

Display Category Name In Main Content

This is a little mod that took me so long to work out (for what it is) that I couldn't not contribute it. I hope it's useful to some and at least unique.

This mod will allow you to display the name of the current category or subcategory in the main page heading, where a clean osC2.2MS would say "Let's see what we have here", in the same manner as the last category listed in the breadcrumb trail.

This would be most useful in instances where you have altered the appearance of osCommerce substantially (perhaps with Simple Template System) and require something a little more obvious on your page than the breadcrumbs or categories box as an indicator of where you are in the catalog.

Email me if anything screws up! :)

Expand All / Collapse All

Best Working Version - Completely Dif. Approach 29 Dec 2006

Full credit for this belongs with the osCommerce knowledge base at this URL:

http://www.oscommerce.info/docs/english/e_display_category_name.html

This approach works perfectly for me. NO FILE DOWNLOAD!

INSTRUCTIONS:

In catalog/include/classes/breadcrumb.php add the following subroutine:

// start of added code for category/subcategory names
function last() { $trail_size = sizeof($this->_trail); return

$this->_trail[$trail_size-1]['title']; }
// end of added code


After this code about line 22:

function breadcrumb() {
$this->reset();
}

function reset() {
$this->_trail = array();
}


In in catalog/index.php (back it up first!), change the first 2 occurrences of HEADING_TITLE (line 76 & line 254).

From:

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


To:

<td class="pageHeading"><?php echo $breadcrumb->last(); ?></td>

NO FILE DOWNLOAD!
enjoy.

Parent category - add to concorde44's 18 April 2006 posting (updated) 19 Oct 2006
Parent category - ad6d to concorde44's 18 April 2006 posting 19 Oct 2006
breadcrumb.php Class Addon 16 Aug 2006
Code Working 18 Apr 2006
Update (again) Nik Le Page 29 Sep 2004
Update for this contrib Nik Le Page 29 Sep 2004
Display Category Name In Main Content Nik Le Page 17 Mar 2004

Note: Contributions are used at own risk.