Ga naar hoofdinhoud

Product Attributes

Product attributes allow you to add extra properties to products, such as colors, sizes, or any other custom attributes.

Structure

Attributes are organized in a two-level hierarchy:

  • Categories: Groups of attributes (e.g., "Color", "Length")
  • Values: Individual attribute values within a category (e.g., "Red", "Blue" for Color)

Database Structure

Tables

  • product_attribute_categories: Stores attribute categories

    • id
    • organisation_id
    • product_id
    • name (category name)
    • sort_order
  • product_attributes: Stores attribute values

    • id
    • organisation_id
    • product_id
    • category_id (foreign key to product_attribute_categories)
    • value (the attribute value)
    • sort_order

API Response

When fetching products via the API, attributes are returned in the following format:

{
"id": 1,
"name": "Nails",
"attributes": [
{
"category_id": 1,
"category_name": "Length",
"values": [
{
"attribute_id": 1,
"attribute_name": "1CM"
},
{
"attribute_id": 2,
"attribute_name": "2CM"
}
]
},
{
"category_id": 2,
"category_name": "Color",
"values": [
{
"attribute_id": 3,
"attribute_name": "Red"
},
{
"attribute_id": 4,
"attribute_name": "Blue"
}
]
}
]
}

Usage in Appointments

When creating appointments, you can include selected attributes:

{
"products": [
{
"product_id": 1,
"attributes": [
{
"category_id": 1,
"category_name": "Length",
"attribute_id": 1,
"attribute_name": "1CM"
}
]
}
]
}

Managing Attributes

Attributes can be managed through the product detail page in the admin interface:

  1. Navigate to Products → Select a product
  2. Click on the "Attributes" tab
  3. Add categories and values as needed
  4. Use drag-and-drop to reorder values within categories