Propiedad, característica o variante que se puede asignar a un Good (por ejemplo "Tamaño", "Sabor", "Instrucciones"). Es la definición a nivel de compañía; su valor por producto se guarda en GoodProperty y el precio/stock por sucursal en BranchProperty.
El campo type es un bitmask cuyo grupo de "uso" (0x0f00) indica de qué tipo es la variante;
el ide-helper lo expone como is_type_options / is_type_range / is_type_text:
| Tipo | Valores en | Descripción |
|---|---|---|
options |
PropertyOption (varias) | Lista de opciones elegibles, cada una con su precio. |
range |
PropertyRange (una) | Rango numérico (min–max, step, unit) con precio base y por paso. |
text |
PropertyText (una) | Texto libre validado por un regex. |
getValues() devuelve las opciones, el rango o el texto según el tipo.
Property se propaga el nuevo nombre a los GoodProperty que aún usaban el
nombre anterior como display_name.property_group_id agrupa propiedades relacionadas (PropertyGroup).| Atributo | Tipo | Descripción |
|---|---|---|
id |
int |
|
name |
string |
Nombre de la variante. |
type |
int |
Bitmask de tipo/uso de la variante; ver la tabla de tipos y los flags is_type_*. |
disabled |
bool |
true si la variante está desactivada y no se ofrece. |
created_at |
datetime\|null |
Fecha de creación. |
updated_at |
datetime\|null |
Fecha de última modificación. |
company_id |
int |
Compañía dueña de la variante (oculto en la respuesta). |
property_group_id |
int\|null |
Grupo de propiedades al que pertenece; null si no está agrupada. |
branch_group_id |
int\|null |
Grupo de comercios al que se acota la variante; null si es de toda la compañía. |
is_type_options |
bool |
BitMask (({@link self::type} & 0x100) !== 0) |
is_type_range |
bool |
BitMask (({@link self::type} & 0x200) !== 0) |
is_type_text |
bool |
BitMask (({@link self::type} & 0x400) !== 0) |
allLogs |
ApiLog> |
Registros de auditoría de la API, incluidos los internos. |
company |
Company |
Compañía dueña de la variante. |
goodProperties |
GoodProperty> |
Asociaciones de esta variante con productos. |
goods |
Good> |
Productos que usan esta variante. |
group |
PropertyGroup\|null |
Grupo de propiedades al que pertenece. |
logs |
ApiLog> |
Registros de auditoría de la API visibles. |
orderedGoodProperties |
OrderedGoodProperty> |
Selecciones de esta variante hechas en órdenes. |
propertyOptions |
PropertyOption> |
Opciones elegibles (si type = options). |
propertyRange |
PropertyRange\|null |
Definición del rango (si type = range). |
propertyText |
PropertyText\|null |
Definición del texto (si type = text). |
requirements |
ServiceSkill> |
Habilidades de servicio requeridas por la variante. |
{
"id": 41,
"name": "Cat1",
"type": 256,
"disabled": false,
"created_at": "2020-04-22 00:00:53",
"updated_at": "2020-04-22 21:10:11",
"property_group_id": null,
"branch_group_id": 42,
"is_type_options": true,
"is_type_range": false,
"is_type_text": false,
"property_options": [
{
"id": 589,
"name": "Cat1",
"price_e2": 1200,
"in_order": 65535,
"created_at": "2020-04-22 21:10:11",
"updated_at": "2020-04-22 21:10:11",
"property_id": 41,
"is_default": false
}
],
"property_range": null,
"property_text": null
}
Crear una variante
Crea una Property y sus valores según el tipo: property_options para
options, rango para range, regex/hint para text.
| Método | URI | Cabeceras |
|---|---|---|
| POST | /companies/{companyId}/properties |
Authorization |
{
"name": "required|string|max:64",
"disabled": "boolean",
"type": "nullable|numeric",
"property_options": [
{
"name": "required_if:type,256|string|max:64",
"price_e2": "required_if:type,256|integer|min:0",
"in_order": "integer|min:0",
"is_default": "boolean"
}
],
"property_range": {
"min": "required_with:property_range|integer",
"max": "required_with:property_range|integer|gt:min",
"decimates": "required_with:property_range|integer|min:0|max:3",
"step": "required_with:property_range|integer|min:1",
"default": "required_with:property_range|integer|gte:min|lte:max",
"base_price_e2": "required_with:property_range|integer|min:0",
"step_price_e2": "required_with:property_range|integer|min:0",
"unit": "max:8"
},
"property_text": {
"regex": "required_with:property_text|string|max:255|pattern",
"hint": "string|max:64"
},
"is_type_options": "nullable|boolean",
"is_type_range": "nullable|boolean",
"is_type_text": "nullable|boolean"
}
| Código | HTTP | Cuándo ocurre |
|---|---|---|
EA205 |
400 | Falta property_options en una variante de tipo options. |
ER006 |
400 | El type enviado no es un tipo de variante válido. |
Crear una variante en una sucursal (compat.)
Variante por branchId; usar preferentemente branch-groups/{id}/properties.
| Método | URI | Cabeceras |
|---|---|---|
| POST | /companies/{companyId}/branches/{branchId}/properties |
Authorization |
{
"name": "required|string|max:64",
"disabled": "boolean",
"type": "nullable|numeric",
"property_options": [
{
"name": "required_if:type,256|string|max:64",
"price_e2": "required_if:type,256|integer|min:0",
"in_order": "integer|min:0",
"is_default": "boolean"
}
],
"property_range": {
"min": "required_with:property_range|integer",
"max": "required_with:property_range|integer|gt:min",
"decimates": "required_with:property_range|integer|min:0|max:3",
"step": "required_with:property_range|integer|min:1",
"default": "required_with:property_range|integer|gte:min|lte:max",
"base_price_e2": "required_with:property_range|integer|min:0",
"step_price_e2": "required_with:property_range|integer|min:0",
"unit": "max:8"
},
"property_text": {
"regex": "required_with:property_text|string|max:255|pattern",
"hint": "string|max:64"
},
"is_type_options": "nullable|boolean",
"is_type_range": "nullable|boolean",
"is_type_text": "nullable|boolean"
}
Crear una variante en un grupo de comercios
Crea una Property acotada al grupo de comercios indicado (branch_group_id).
| Método | URI | Cabeceras |
|---|---|---|
| POST | /companies/{companyId}/branch-groups/{branchGroupId}/properties |
Authorization |
{
"name": "required|string|max:64",
"disabled": "boolean",
"type": "nullable|numeric",
"property_options": [
{
"name": "required_if:type,256|string|max:64",
"price_e2": "required_if:type,256|integer|min:0",
"in_order": "integer|min:0",
"is_default": "boolean"
}
],
"property_range": {
"min": "required_with:property_range|integer",
"max": "required_with:property_range|integer|gt:min",
"decimates": "required_with:property_range|integer|min:0|max:3",
"step": "required_with:property_range|integer|min:1",
"default": "required_with:property_range|integer|gte:min|lte:max",
"base_price_e2": "required_with:property_range|integer|min:0",
"step_price_e2": "required_with:property_range|integer|min:0",
"unit": "max:8"
},
"property_text": {
"regex": "required_with:property_text|string|max:255|pattern",
"hint": "string|max:64"
},
"is_type_options": "nullable|boolean",
"is_type_range": "nullable|boolean",
"is_type_text": "nullable|boolean"
}
{info} Soporta: Paginación Filters Carga dinámica
Listar variantes
Devuelve las Property de la compañía con sus opciones/rango/texto, paginadas.
| Método | URI | Cabeceras |
|---|---|---|
| GET | /companies/{companyId}/properties |
N/A |
{info} Soporta: Paginación Filters Carga dinámica
Listar las variantes de un producto
Devuelve las GoodProperty del producto indicado.
| Método | URI | Cabeceras |
|---|---|---|
| GET | /companies/{companyId}/goods/{goodId}/properties |
Authorization |
{info} Soporta: Paginación Filters Carga dinámica
Listar las variantes de una sucursal (compat.)
Variante por branchId del listado; usar preferentemente branch-groups/{id}/properties.
| Método | URI | Cabeceras |
|---|---|---|
| GET | /companies/{companyId}/branches/{branchId}/properties |
Authorization |
{info} Soporta: Paginación Filters Carga dinámica
Listar las variantes de un grupo de comercios
Devuelve las Property del grupo de comercios indicado.
| Método | URI | Cabeceras |
|---|---|---|
| GET | /companies/{companyId}/branch-groups/{branchGroupId}/properties |
Authorization |
{info} Soporta: Carga dinámica
Ver una variante
Devuelve la Property indicada con sus valores.
| Método | URI | Cabeceras |
|---|---|---|
| GET | /companies/{companyId}/properties/{propertyId} |
N/A |
Actualizar una variante
Modifica la Property y, si cambian, sus opciones/rango/texto.
| Método | URI | Cabeceras |
|---|---|---|
| PATCH | /companies/{companyId}/properties/{propertyId} |
Authorization |
{
"name": "required|string|max:64",
"disabled": "boolean",
"type": "nullable|numeric",
"property_options": [
{
"name": "required_if:type,256|string|max:64",
"price_e2": "required_if:type,256|integer|min:0",
"in_order": "integer|min:0",
"is_default": "boolean"
}
],
"property_range": {
"min": "required_with:property_range|integer",
"max": "required_with:property_range|integer|gt:min",
"decimates": "required_with:property_range|integer|min:0|max:3",
"step": "required_with:property_range|integer|min:1",
"default": "required_with:property_range|integer|gte:min|lte:max",
"base_price_e2": "required_with:property_range|integer|min:0",
"step_price_e2": "required_with:property_range|integer|min:0",
"unit": "max:8"
},
"property_text": {
"regex": "required_with:property_text|string|max:255|pattern",
"hint": "string|max:64"
},
"is_type_options": "nullable|boolean",
"is_type_range": "nullable|boolean",
"is_type_text": "nullable|boolean"
}
| Código | HTTP | Cuándo ocurre |
|---|---|---|
EA205 |
400 | Falta property_options en una variante de tipo options. |
ER006 |
400 | El type enviado no es un tipo de variante válido. |
Asignar las variantes de un producto
Reemplaza el conjunto de Property del producto por el enviado, creando los
GoodProperty correspondientes con sus reglas de options.
| Método | URI | Cabeceras |
|---|---|---|
| POST | /companies/{companyId}/goods/{goodId}/properties |
Authorization |
[
{
"property_id": "required|integer",
"options": "nullable|integer|min:1",
"display_name": "required|string|max:64",
"disabled": "boolean",
"prop_type": "nullable|integer|min:0|max:4095",
"is_type_options": "nullable|boolean",
"is_type_range": "nullable|boolean",
"is_type_text": "nullable|boolean",
"is_dynamic": "nullable|boolean",
"is_free": "nullable|boolean",
"is_consumable": "nullable|boolean",
"is_multi_selection": "nullable|boolean",
"min_count": "nullable|integer|min:0|max:15",
"max_count": "nullable|integer|min:0|max:15",
"stack_count": "nullable|integer|min:0|max:15",
"is_admin_customizable": "nullable|boolean"
}
]
Eliminar una variante
Borra la Property indicada.
| Método | URI | Cabeceras |
|---|---|---|
| DELETE | /companies/{companyId}/properties/{propertyId} |
Authorization |
allLogs HasMany ApiLogcompany BelongsTo CompanygoodProperties HasMany GoodPropertygoods HasMany Goodgroup BelongsTo PropertyGrouplogs HasMany ApiLogorderedGoodProperties HasMany OrderedGoodPropertypropertyOptions HasMany PropertyOptionpropertyRange HasOne PropertyRangepropertyText HasOne PropertyTextrequirements HasMany ServiceSkill