Skip to main content

Breadcrumb

A breadcrumb displays the sequential path of pages, indicating the complete path to the current page and offering a means to navigate back to previous points.

FieldData TypeDescription
labelstringUser-friendly text for the URL.
urlstringThe URL of the menu item.
levelintThe breadcrumb level.
pkUUIDThe UUID of the menu item.
sort_orderintThe order from the oldest ancestor to the current menu item, equal to the level field.
pathstringThe breadcrumb path, with each step encoded into 4 characters.
parent_pkNullAlways null.
parentNullAlways null.
generator_namestringGenerator name, e.g., menu_item.
extra_contextJSONAdditional information about the object, such as numchild and attributes.

GET Generate Breadcrumb

The path field stores the complete breadcrumb path, where every 4 characters represent a distinct breadcrumb step. For example, if the path is 0001000N0002, then 0001 is the first step, 000N is the second, and 0002 is the third. This way, the objects with the values 0001 and 0001000N of the path field become its ancestors.

Path: https://{commerce_url}/menus/generate_breadcrumb/

This method is used to fetch a menu with the given UUID and its ancestors.

Query Parameters

To generate a breadcrumb, the following query parameters must be provided:

Query String ParamsData TypeDescription
itemstringMenu item UUID to generate the breadcrumb.
generator_namestringGenerator name, e.g., menu_item.

Example Response (200 OK)

{
"menu": [
{
"label": null,
"url": "/",
"level": 0,
"pk": "0ad242e3-90e4-421e-98c9-50f682cde230",
"sort_order": 0,
"path": "0001000N",
"parent_pk": null,
"parent": null,
"generator_name": "menu_item",
"extra_context": {
"attributes": {
"category_id": null
},
"numchild": 2
}
},
{
"label": null,
"url": "selamsmsm",
"level": 1,
"pk": "1a300982-a19d-457f-8d68-6a9dee448a56",
"sort_order": 1,
"path": "0001000N0002",
"parent_pk": null,
"parent": null,
"generator_name": "menu_item",
"extra_context": {
"attributes": {
"category_id": null
},
"numchild": 1
}
}
]
}

Example Response (400 Bad Request)

If both item and generator_name are not sent as query parameters, the system will return a 400 bad request response, indicating the missing parameters like below:

{
"item": [
"Bu alan gerekli."
],
"generator_name": [
"Bu alan gerekli."
]
}