Skip to main content

Detect parent category

More
8 years 4 months ago #292695 by info@vesica.org
Hi,

How can I detect if a category is a parent category on the com_hikashop/views/category/tmpl/listing.php ?

thanks!

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #292697 by nicolas
Replied by nicolas on topic Detect parent category
Hi,

I'm not sure what you want exactly so hard to say.
On a category listing, there are:
- the main category of the listing
- the categories (which are sub categories of that main category)
- the products of the main category

Do you want :
- to know if the main category has sub categories ?
- to know if each sub category has itself sub categories ?
- something else ?

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago - 8 years 4 months ago #292766 by info@vesica.org
Hi,

yes, I want to know if the main category has subcategories.

I want to write a condition when a category has subcategories.

thanks!
Last edit: 8 years 4 months ago by info@vesica.org.

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #292772 by nicolas
Replied by nicolas on topic Detect parent category
Hi,

Then you can do like that:
Code:
if(empty($this->rows)) { // no sub categories } else { // has sub categories }
The following user(s) said Thank You: info@vesica.org

Please Log in or Create an account to join the conversation.

Time to create page: 0.153 seconds
Powered by Kunena Forum