Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Replace HEADING_TITLE with Category Name


Roger Huston

Recommended Posts

Hello,

 

I need a little PHP/SQL help here.

 

What I want to do is to replace the "Let's see what we have here" with the name of proper Category Name. By default, it pulls the text from the english/index.php.

 

I am looking in index.php and I know it handles the home page of the store. I do not want to change that, only the category listing pages that show the products.

 

What I do not know how to do is to find out the current category name. I am looking to replace the proper

 

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

 

with something like

 

<td class="pageHeading"><?php echo $category['categories_name'] ?></td>

 

or something like that. That way, instead of having static text, it would display the category that I am at.

 

So I think I need a query to pull the name and which <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> in index.php I need to replace.

 

Has anyone done this before?

 

- Roger

Link to comment
Share on other sites

Hello,

 

I need a little PHP/SQL help here.

 

What I want to do is to replace the "Let's see what we have here" with the name of proper Category Name. By default, it pulls the text from the english/index.php.

 

I am looking in index.php and I know it handles the home page of the store. I do not want to change that, only the category listing pages that show the products.

 

What I do not know how to do is to find out the current category name. I am looking to replace the proper

 

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

 

with something like

 

<td class="pageHeading"><?php echo $category['categories_name'] ?></td>

 

or something like that. That way, instead of having static text, it would display the category that I am at.

 

So I think I need a query to pull the name and which <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> in index.php I need to replace.

 

Has anyone done this before?

 

- Roger

 

Yes ,

 

you need this above the that code inside the ?>

 

$categories_name_query = $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");

$categories_name = tep_db_fetch_array($categories_name_query);

$category_name = $categories_name['categories_name'];

 

(ps this may be already there just try the code below...)

 

 

 

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

 

 

that should work and this is what it should look like,

cheers

Rusty

-------------------------------------------

Link to comment
Share on other sites

Rusty,

 

Works GREAT! I removed "= $categories_query" from the first line as it looked like you copied and pasted from somewhere else and did not intend to reset that variable.

 

May I ask, is there documentation that tells one how to do things like this. I am not a programmer, but I know enough to be able to read what the statements are doing, but not the built in functions. Or does everyone just learn by looking around and trying to find something close and then just hacking it?

 

- Roger

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...