Update CatalogOption.
New APIs
This resource is for adding new supported option type values, such as: radio button, checkbox, domain, etc.
This resource is used for adding new "positions" where the options could be visualised. For example: order-flow, shopping cart, admin panel, etc.
Relational resource for connection optionid to position. E.g. optionid: 1 is visible at admin panel.
For backward compatibility, the QueryBuilder will work as it used to work. This query will be automatically converted to the next one:
$params = http_build_query([
'where' => [
[
'field' => 'visibility',
'where' => 'and',
'type' => 'equalTo',
'value' => 'cart'
],
]
]);
It will be automatically converted to:
$params = http_build_query([
'where' => [
[
'field' => 'catalog_option_visibility.position',
'where' => 'and',
'type' => 'equalTo',
'value' => 'cart'
],
]
]);
{
"option_id": 273,
"name": "Item limit",
"...":"...",
"visibility": [
"cart",
"site",
"order-flow",
"everywhere"
]
}
The system is automatically provision the "default" visibilities if no visibilities are sent. So if the system is configured to have default visibility at order-flow, and do not provide it, the system will automatically create it. Also the system supports the visibility to be in two options: as a string or as an array.
The create method runs in "SQL Transaction" So if the visibility adding crash, the option will not be committed.
String:
{
"visibility": "order-flow"
}
OR
Array:
{
"visibility": ["order-flow", "cart"]
}
Option Type Value is with changed logic, but do will not affect the work of the system. The SQL field iis changed from ENUM to VARCHAR. There is new resource: Option Type Value which handles all available optiontypevavlues. On adding an option, the system automatically checks is the value provided in the field optiontypevalue, exist in the new resource. If do not exist, will return validation issue.
On update, the system will remove all positions and will add them again. Based on the "visibility" node.
The update method runs in "SQL Transaction" So if the visibility adding crash, the option will not be committed.
'Billing\\V1\\Rest\\CatalogOption\\Validator' => array(
0 => array(
'name' => 'trash',
'required' => true,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StripTags',
),
1 => array(
'name' => 'Zend\\Filter\\Digits',
),
),
'validators' => array(),
),
1 => array(
'name' => 'name',
'required' => false,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StringTrim',
),
1 => array(
'name' => 'Zend\\Filter\\StripTags',
),
),
'validators' => array(
0 => array(
'name' => 'Zend\\Validator\\StringLength',
'options' => array(
'min' => 1,
'max' => '255',
),
),
),
),
2 => array(
'name' => 'namespace',
'required' => false,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StringTrim',
),
1 => array(
'name' => 'Zend\\Filter\\StripTags',
),
),
'validators' => array(
0 => array(
'name' => 'Zend\\Validator\\StringLength',
'options' => array(
'min' => 1,
'max' => '255',
),
),
),
),
3 => array(
'name' => 'option_key',
'required' => false,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StringTrim',
),
1 => array(
'name' => 'Zend\\Filter\\StripTags',
),
),
'validators' => array(
0 => array(
'name' => 'Zend\\Validator\\StringLength',
'options' => array(
'min' => 1,
'max' => '255',
),
),
),
),
4 => array(
'name' => 'instruction',
'required' => false,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StringTrim',
),
1 => array(
'name' => 'Zend\\Filter\\StripTags',
),
),
'validators' => array(
0 => array(
'name' => 'Zend\\Validator\\StringLength',
'options' => array(
'min' => 1,
'max' => '255',
),
),
),
),
5 => array(
'name' => 'required',
'required' => true,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StripTags',
),
1 => array(
'name' => 'Zend\\Filter\\Digits',
),
),
'validators' => array(),
),
6 => array(
'name' => 'provider',
'required' => true,
'filters' => array(),
'validators' => array(),
),
7 => array(
'name' => 'option_type',
'required' => true,
'filters' => array(),
'validators' => array(),
),
8 => array(
'name' => 'option_type_value',
'required' => true,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StringTrim',
),
1 => array(
'name' => 'Zend\\Filter\\StripTags',
),
),
'validators' => array(
0 => array(
'name' => 'ZF\\ContentValidation\\Validator\\DbRecordExists',
'options' => array(
'adapter' => 'apihawk_database',
'table' => 'catalog_option_type_value',
'field' => 'name',
),
),
1 => array(
'name' => 'Zend\\Validator\\StringLength',
'options' => array(
'min' => 1,
'max' => '255',
),
),
),
),
9 => array(
'name' => 'product_identifier',
'required' => true,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StripTags',
),
1 => array(
'name' => 'Zend\\Filter\\Digits',
),
),
'validators' => array(),
),
10 => array(
'name' => 'validator',
'required' => true,
'filters' => array(),
'validators' => array(),
),
11 => array(
'name' => 'autopopulate',
'required' => true,
'filters' => array(
0 => array(
'name' => 'Zend\\Filter\\StripTags',
),
1 => array(
'name' => 'Zend\\Filter\\Digits',
),
),
'validators' => array(),
),
12 => array(
'name' => 'calc_strategy_on_zero_price',
'required' => true,
'filters' => array(),
'validators' => array(),
),
13 => array(
'name' => 'behavior',
'required' => false,
'filters' => array(),
'validators' => array(),
),
),