Getting product-categories

Prerequisites

You should have

  • an user-account enabled for api access & PIM access
  • an api-client
  • at least on product-category stored in your Hublify PIM

 

Helpful to know

Some facts ...

  • category-data can have own customized "payload"-data.
    See standard fields here: ....
    This is e.g. short- /long-description, media-file(s), HTML-Meta-data, ...
  • A product-group is identified best by its "node_code".
  • The hierarchical category-structure contains fields and values such as:
    (Which can be very helpful for html rendering)
    • numerical ID and fahter-ID
    • Number of sub-categories
    • Number of depth-level of group
  • Category data itself can also be customized and extended field-wise
  • Each product can be assigned to none, one or many categories

 

Getting all categories

You can get all categories easily and comfortably structured with one api-call.

Use this e.g. for building a product-group-navigation.

The following (shortened) example contains some of the standard category fields. This might vary in other setups.

 

Request URL

https://{your hublify url}/api/eos_10/data_getList

Request parameter

{
    "dataset": "productgroup"
}

Response

{
    "status": true,
    "data": [
        {
            "node_path": "|Wohninterieur",
            "node_name": "Wohninterieur",
            "node_code": "living_interior",       // Use this as primary identifier !
            "node_id": "1",
            "node_idfather": "0",
            "active": "1",
            "children": "10.0000",                // Number sub-groups
            "depth": "0",                         // Depth of this group (0 = top level)
            "title": "Wohninterieurs",
            "teaser": null,
            "body": null,
            "emb_img_label": {                    // Optional images for product group
                "model": "mam_asset",
                "data": [
                    {
                        "mb_label": "ecs_plugin_shop_demodata_testbild_categoryworld",
                        "name": "testbild_categoryworld.jpg",
                        "mb_preview": "\/ecs_plugin_shop_demodata\/.preview.ecms\/testbild_categoryworld.jpg___thumb.jpg",
                        "mb_title": "testbild_categoryworld",
                        "mb_caption": "",
                        "mb_keywords": "",
                        "url": "\/files\/\/ecs_plugin_shop_demodata\/testbild_categoryworld.jpg",
                    }
                ]
            },

            "marketing_name": null,
            "marketing_teaser": null,
            "marketing_image": null,
            "marketing_image_background": null,
            "marketing_overlay_html": null,

            "meta_title": null,
            "meta_description": null,
            "meta_keywords": null,

            "promoted_products": null,

            "primaryValue": "1172",
            "primaryKey": "xc__id",
            "displayValue": "Wohninterieurs",
            "displayKey": "title",

            ... // EXAMPLE SHORTENED !
        },
        {
            "node_path": "|Wohninterieur|Lampen",
            "node_name": "Lampen",
            "node_code": "lightning",
            "node_id": "2",
            "node_idfather": "1",
            "active": "1",
            "children": "4.0000",
            "depth": "1",
            "title": "Lampen",
            "teaser": null,
            "body": "Unsere Lampenwelt bietet eine ... Lorem ...",
            "emb_img_label": {
                "model": "mam_asset",
                "data": [
                    {
                        "mb_label": "ecs_plugin_shop_demodata_graypants_gp00002_11zoll_2",
                        "url": "\/files\/\/ecs_plugin_shop_demodata\/graypants_GP00002_11zoll_2.jpg",
                        ... // EXAMPLE SHORTENED
                    }
                ]
            },
            "promoted_products": {
                "model": "cdb_record",
                "data": [
                    {
                        "pcode": "GP00001",
                        "model": "product",
                        "primaryValue": "GP00001",
                        "primaryKey": "pcode",
                        "displayValue": "Arcturus H\u00e4ngeleuchte",
                        "displayKey": "name",
                        ... // EXAMPLE SHORTENED
                    },
                    {
                        "pcode": "FKTB0002",
                        "name": "KTribe Lampen-Bundle",
                        "model": "product",
                        "primaryValue": "FKTB0002",
                        "primaryKey": "pcode",
                        "displayValue": "KTribe Lampen-Bundle",
                        "displayKey": "name"
                    },
                    ...   // EXAMPLE SHORTENED
                ]
            },
            "primaryValue": "1176",
            "primaryKey": "xc__id",
            "displayValue": "Lampen",
            "displayKey": "title"
        },

        ...     // EXAMPLE SHORTENED
}
 

 

 

Getting a single category

  • Get all fields / data for one category, e.g. to render a category-detail html-page
  • Additionally get all products within this category, to render a product-list on this category-detail-page
    (show example here, or link to another article?!)

...

 

Getting all subcategories

...

 

Getting the category path

...

For e.g. rendering a breadcrumb path.