Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can anybody see what i have got wrong here


julianpuje

Recommended Posts

Posted

I am trying to get my category name to show at the top of the page instead of the "lets See" bit. I now have this in my Catalog/Index.php but it doesn't do anything?? The lets see bit has gone but hasn't been replaced with the code below? Can anybody see what i've done wrong? <_<

 

TIA

Julian

 

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

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Posted

Have you tried replacing the square brackets with rounded brackets (not curly brackets).

 

Vger

Posted

Try changing this

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

to this

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

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted
Try changing this
 <td class="pageHeading"><?php echo $categories['categories_name']; ?></td>

to this

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

 

Jack

 

That worked Jack Thanks. :thumbsup:

It adds the category name above all the pages with sub cats. Do you know how i can get the product list page to show the category it is in. I've tried this:-

 <td align="middle" class="pageHeading"><?php echo HEADING_TITLE . $tree[$current_category_id]['name']; ?></td>

but that doesn't do anything. I want to keep the heading title so i can add text before the cat name.

TIA

Julian

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Posted

I've now found that this code

<td align="middle" class="pageHeading"><?php echo HEADING_TITLE . $tree[$current_category_id]['name']; ?></td>

does add my text defined in my languages/index.php but doesn't add the category after it.

I want it to say eg, Selection of (defined in index.php) then add the category after it.

Any ideas why it's not showing please.

 

TIA

Julian

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Posted

The products are displayed using a different section of code than what the categories section uses. If you look at the code in your index.php file, you will see three sections defined by

if ($category_depth == 'nested') {
...
} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {
...
else {

The categories are read in from the database in the first section. So if you are trying to display the category results in the second section (products), it won't work as is. You can copy the code used to call in the categories from the database and put it in the second section, then you idea should work.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted

Thanks Jack, I think i know what you mean but i'm really trying to change something i don't really know much about. Your explanation is probably quite straight forward, but i don't really understand what to put where. I'm new to tweaking the code and trying to learn it the best i can, is it possible to give me an example of the code i'm after, and maybe i'll understand it more.

Feel a bit stupid :blush:

 

TIA

 

Julian

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Posted

No need to feel that way. All of us are learning here. :) Here's what you do. In index.php find this code:

  } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

and add this right below it

$category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
   $category = tep_db_fetch_array($category_query);

Then, a little farther down find this line

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

and below it add

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

Does that do what you want?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted

Excellent.... Thanks Jack for all your help, your a star. :thumbsup:

It finally works! i ended up changing the last line to :

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

and that works fine.

Thanks again for all your help.

 

Julian :D

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Archived

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

×
×
  • Create New...