Author Topic: Get child categories by parent category id  (Read 266 times)

Huubs

  • Jr. Member
  • **
  • Posts: 262
Get child categories by parent category id
« on: October 12, 2020, 11:38:11 am »
Hello,

I'm trying to get the child categories by parent category id. Someoen know how to do this?

Rsn

  • Jr. Member
  • **
  • Posts: 53
  • Advanced user
    • Blog InformResource
Re: Get child categories by parent category id
« Reply #1 on: October 12, 2020, 12:26:23 pm »
Try PHP class JFTree.
Look here http://forum.virtuemart.net/index.php?topic=137563.msg517279#msg517279
Just yesterday I wrote about it  :)

Huubs

  • Jr. Member
  • **
  • Posts: 262
Re: Get child categories by parent category id
« Reply #2 on: October 12, 2020, 13:42:58 pm »
Try PHP class JFTree.
Look here http://forum.virtuemart.net/index.php?topic=137563.msg517279#msg517279
Just yesterday I wrote about it  :)

I think there is also a method for this.. A native method implemented in the Virtuemart model.

Huubs

  • Jr. Member
  • **
  • Posts: 262
Re: Get child categories by parent category id
« Reply #3 on: October 13, 2020, 15:16:53 pm »
There should be some easy way right? How else is the category page getting the child categories as well? It's basically on the category page and I want to get the sub categories of a subcategory on the category page. So i have this category ID, so I should get the subcategories fairly easy right?

Found it:

Code: [Select]
$categoryModel= VmModel::getModel('category');
$categoryChildren = $categoryModelTemp->getChildCategoryList(0, $category->virtuemart_category_id);


Rsn

  • Jr. Member
  • **
  • Posts: 53
  • Advanced user
    • Blog InformResource
Re: Get child categories by parent category id
« Reply #4 on: October 13, 2020, 18:19:25 pm »
@Huubs, it return children all levels?

Huubs

  • Jr. Member
  • **
  • Posts: 262
Re: Get child categories by parent category id
« Reply #5 on: October 15, 2020, 09:53:22 am »
@Huubs, it return children all levels?
Only the subcategories from that category, which is what I wanted.