Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

A little code help please


sam6

Recommended Posts

Hi I use this code to display the current categorie in certian situations.

 

<?php echo ucwords(strtolower($categories['categories_name'])); ?>

 

I would also like to display the parrent categorie if there is one.

 

so if you ar selling a mazda it says

 

mazda

 

when you go to subcategorie it says the sub catagorie i would like it to also tell me the perrent categorie of the sub categorie.

 

I have been trying for like a month can any one help

 

thanks

Link to comment
Share on other sites

You would want something like

$parent_category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$categories['parent_id'] . "'");
$parent_category = tep_db_fetch_array($parent_category_query);
echo ucwords(strtolower($categories['categories_name']));

You may need to add parent_id to the query that populates the $categories array.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...