Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Display parent catagory name.


Recommended Posts

Hi all. 

Just wondering if there is a simple way to display the name of the parent catagory on a page, if customer is on a sub catagory?


im not great at coding, but the logic would be something like:

if catagory depth greater than 1, echo parent catagory name,  else echo current catagory name. 




Link to comment
Share on other sites

If you have the breadcrumb showing, it will display the path. But that is not on the actual page and may not be what you want.

On sub-category pages, the $cPath variable will be set to something like XX_YY, where XX is the parent category and YY is the sub-category. So you could break that apart and get the category name for the parent. Or, you can change the MySQL statement to get the parent_id and then get its name. Either way will work. If you are using a newer version you can use the category class to return the name. So there are many ways to do it. Without knowing your version and experience level, it won't help to go into much detaul.

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

Link to comment
Share on other sites


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

  • Create New...