AbanteCart Community

AbanteCart Development => API Development => Topic started by: ahmad-sabra on April 11, 2016, 10:04:02 AM

Title: Get Sub-Categories Problem in API
Post by: ahmad-sabra on April 11, 2016, 10:04:02 AM
hello;

im trying to retrieve sub-categories for a specific category. this request '?rt=a/product/category&category_id=84' is
returning
{
   "category_id": "84",
   "parent_id": "0",
   "sort_order": "0",
   "status": "1",
   "date_added": "2016-04-08 14:43:46",
   "date_modified": "2016-04-11 16:33:50",
   "language_id": "1",
   "name": "Car Rental",
   "meta_keywords": "",
   "meta_description": "",
   "description": "",
   "store_id": "0",
   "products_count": "0",
   "tumbnail":"",
   "total_products": "0",
   "total_subcategories": "3"
}

No sub-categories are shown...please any help(i have create sub categories under this category with id=84).
is their any problem or i have made some wrong step on creating these sub-categories(i have made 3 sub-categories)
Title: Re: Get Sub-Categories Problem in API
Post by: abantecart on April 14, 2016, 09:29:55 AM
This request  '?rt=a/product/category&category_id=84' should work

1. Check that your subcategories are enabled and have products, and finally in the right store (if you have multiple)

2. If #1 is correct, check in the file
storefront/controller/api/product/category.php

Check if you get to line #77 then you request. Below code should be executed.
Code: [Select]
if ($category_info['total_products']) {
        $category_info['subcategories'] = $this->getCategories( $category_id );

}
Title: Re: Get Sub-Categories Problem in API
Post by: ahmad-sabra on April 28, 2016, 07:25:13 AM
hello,
i have tried what you have mention,but i cant find the problem.
i have 3 categories and every category have sub-categories and every sub-category has sub-categries and every subcategory have products...all thes sub categories are enabled and all final sub-categories have products.
so where i can find the problem ?