Jomy Joseph
Jomy Joseph

Reputation: 107

How to get all products in a parent category (first level) in opencart?

How to get all products in a parent category (first level) in opencart?

including all subcategories and their products

All products under a menu(category) including its subcategory products(children)

Upvotes: 0

Views: 1889

Answers (1)

shadyyx
shadyyx

Reputation: 16055

Considering You have ID of current category stored in $category_id, You could try:

$data = array(
    'filter_category_id'  => $category_id,
    'filter_sub_category' => true
);

$products = $this->model_catalog_product->getProducts($data);

Upvotes: 3

Related Questions