News:

Support the VirtueMart project and become a member

Main Menu

Get child categories by parent category id

Started by Kuubs, October 12, 2020, 11:38:11 AM

Previous topic - Next topic

Kuubs

Hello,

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

Rsn


Kuubs

Quote from: Rsn 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  :)

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

Kuubs

#3
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:

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



Rsn


Kuubs

Quote from: Rsn on October 13, 2020, 18:19:25 PM
@Huubs, it return children all levels?
Only the subcategories from that category, which is what I wanted.