diff options
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/brand_homepage.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/brand_homepage.py b/indoteknik_api/controllers/api_v1/brand_homepage.py index 75b779d7..a6a17e88 100644 --- a/indoteknik_api/controllers/api_v1/brand_homepage.py +++ b/indoteknik_api/controllers/api_v1/brand_homepage.py @@ -25,6 +25,13 @@ class BrandHomepage(controller.Controller): ('x_manufacture', '=', brand_homepage.manufacture_id.id) ] products = request.env['product.template'].search(query_product, order='product_rating desc', limit=8) + + categories = [] + for product in products: + for c in product.public_categ_ids: + categories.append(c.name) + categories = list(dict.fromkeys(categories)) + data.append({ 'sequence': brand_homepage.sequence, 'manufacture_id': brand_homepage.manufacture_id.id, @@ -32,6 +39,7 @@ class BrandHomepage(controller.Controller): 'image': base_url + 'api/image/website.brand.homepage/image/' + str( brand_homepage.id) if brand_homepage.image else '', 'url': brand_homepage.url, + 'categories': [y for y in categories], 'products': [request.env['product.template'].api_single_response(x) for x in products] }) |
