Zen Cart Logo
Forums / General Questions / Replace catagories title with current catagory name.

Replace catagories title with current catagory name.

Locked

Views: 1,237

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
6 Sep 2008, 5:37 PM
#1
chalfontgifts avatar

chalfontgifts

Zen Follower

Join Date:
Jun 2007
Posts:
122
Plugin Contributions:
0

Replace catagories title with current catagory name.

Can someone guide me how I can replce the Title of the catagories box with the current selected catagory.

I think it is this line in catgories.php :

$title = BOX_HEADING_CATEGORIES;

I have to chage, but not sure how to pickup the current catagory and place it in $title.

Regards
Laurie

<?php /** * categories sidebox - prepares content for the main categories sidebox * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: categories.php 2718 2005-12-28 06:42:39Z drbyte $ */ $main_category_tree = new category_tree; $row = 0; $box_categories_array = array(); // don't build a tree when no categories $check_categories = $db->Execute("select categories_id from " . TABLE_CATEGORIES . " where categories_status=1 limit 1"); if ($check_categories->RecordCount() > 0) { $box_categories_array = $main_category_tree->zen_category_tree(); } require($template->get_template_dir('tpl_categories.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_categories.php'); $title = BOX_HEADING_CATEGORIES; $title_link = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); ?>
7 Sep 2008, 3:33 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Replace catagories title with current catagory name.

Add this after the
$title = BOX_HEADING_CATEGORIES;
$title_link = false;
lines:```php
$title = BOX_HEADING_CATEGORIES;
$title_link = false;

for ($i=0;$i<sizeof($box_categories_array);$i++) { //use current cat (if any) for box title
if ($box_categories_array[$i]['current']) {
$title = $box_categories_array[$i]['name'];
break;
}
} // /current

This is designed to account for the case where no category is selected by leaving the defined box heading as default. You can change the definition in /includes/languages/your_template/english.php:

define('BOX_HEADING_CATEGORIES', 'Categories');
7 Sep 2008, 6:52 AM
#3
chalfontgifts avatar

chalfontgifts

Zen Follower

Join Date:
Jun 2007
Posts:
122
Plugin Contributions:
0

Re: Replace catagories title with current catagory name.

Thank you Glen for your time on this. Worked like a charm.

Regards
Laurie