Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

category's name in main text area


Guest

Recommended Posts

Hi,

 

I have followed this code to make the name of the category show up in the main text box:

In default.php change the following:

 

Code:

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

 

To:

 

Code:

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

 

There are 3 occurances of this do not change the last one after:

Code:

} else { // default page

 

What happens is that it does work only if a category has other categories underneath it. If a category has only products listed this will not work.

 

An example site is :

www.affairstoremember.org/catalog/

All of the categories have other categories underneath them except the stationary one.

 

Does anyone know how to make this work with the category that only has products underneath it and also how to get the name of the sub-categories to show up in the main text area?

 

Thanks!

Link to comment
Share on other sites

Try this:

 

Around line 220:

    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <form>

         <tr>

           <td class="pageHeading"><?php echo HEADING_TITLE . ' ' . tep_get_categories_name($cPath); ?></td>

<?php

// optional Product List Filter

 

Add this function to general.php

////

// WebMakers.com Added: Find a Categories Name

// TABLES: categories_description

 function tep_get_categories_name($who_am_i) {

   global $languages_id;

   $the_categories_name_query= tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id= '" . $who_am_i . "' and language_id= '" . $languages_id . "'");



   $the_categories_name = tep_db_fetch_array($the_categories_name_query);

   return $the_categories_name['categories_name'];

 }

Link to comment
Share on other sites

It works but it is adding the word "Categories" to all the listings like:

Categories DVD Movies

Categories Hardware

Categories Software

 

uh...how do you remove the word "Categories"?

Link to comment
Share on other sites

Gosh Linda...making me think tonight!

 

I removed the words "Categories" and "Lets See What We have here" and each category name is listed instead.

 

Is there a way, when you click on the sub-category, to have it say:

Software Action or is this too much?

 

Right now it says Software because it is in that category.

 

This is really fun!

Link to comment
Share on other sites

You'd need to look up the parent category for the current category and if not the same, then add that name on in front using the function I gave you.

 

I think in general.php there is a function to grab the parent category id.

Link to comment
Share on other sites

NOTE: $current_category_id works better than $cPath on the subdirectories.

 

Might want to change that.

 

It seems to work for me okay on my Categories Box, but was not doing a very good job on my Categories Tabs.

 

Not sure if that will effect other things.

Link to comment
Share on other sites

I think I will leave it as is. I really am lost with what you said...sorry. :(

 

It looks nice and I think my customers will like this change.

 

Thanks for all your help! I really appreciate it!

Link to comment
Share on other sites

Basically the idea was use this line instead of the other:

 

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

 

The $cPath was not giving me consistant results on everything ... but that may just be the add-on I am using.

Link to comment
Share on other sites

Linda,

 

That worked great on my test site!

 

I will change a couple of the stores to check but should be ok. I don't have many changes to my stores.

 

Thanks again!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...