Skip to main content
added 2 characters in body
Source Link
develophper
  • 2.2k
  • 6
  • 33
  • 52

I am looking for a way to get a products most child like category. For example if I have

    category1 -> category1.1 -> category1.1.1

I then need category1.1.1

Assuming I have a product that belongs to all three categories is there a specific way to call the most deeply rooted category.

I know I can return all categories belonging to a product by doing this:

    echo $_product->getCategoryIds()

But I need a programmatical way to know which is the deepest child.

I am looking for a way to get a products most child like category. For example if I have

    category1 -> category1.1 -> category1.1.1

I then need category1.1.1

Assuming I have a product that belongs to all three categories is there a specific way to call the most deeply rooted category.

I know I can return all categories belonging to a product by doing this:

    echo $_product->getCategoryIds()

But I need a programmatical way to know which is the deepest child.

I am looking for a way to get a products most child like category. For example if I have

    category1 -> category1.1 -> category1.1.1

I then need category1.1.1

Assuming I have a product that belongs to all three categories is there a specific way to call the most deeply rooted category.

I know I can return all categories belonging to a product by doing this:

    echo $_product->getCategoryIds()

But I need a programmatical way to know which is the deepest child.

Tweeted twitter.com/#!/StackMagento/status/377541691647229952
Source Link
develophper
  • 2.2k
  • 6
  • 33
  • 52

Getting a products child category

I am looking for a way to get a products most child like category. For example if I have

    category1 -> category1.1 -> category1.1.1

I then need category1.1.1

Assuming I have a product that belongs to all three categories is there a specific way to call the most deeply rooted category.

I know I can return all categories belonging to a product by doing this:

    echo $_product->getCategoryIds()

But I need a programmatical way to know which is the deepest child.