Open salgua opened 1 year ago
Hi @salgua. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hi @salgua ,
Thanks for your contribution and collaboration.
I have tried to reproduce the issue in fresh 2.4-develop instance and this issue is the expected behaviour of Magento. Whenever options is created for custom attribute multi-select, Magento generate unique increment id for the options created. Below is the screenshot for your reference:
Let us know if your facing any issue.
Thanks
Hi @engcom-Lima,
I suspected it was the default behavior, but at this point I'm wondering: what's the point of passing it the "value" parameter? In your request you passed "value": "m3_value_shu"
, where does Magento save this data and how do I get it?
Thanks
This ticket needs further Dev triage . Hence, labelling as "Dev Experience"
Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hi @salgua ,
Thank you for the response. Verified the behavior on Magento 2.4-develop instance and is reproducible. Value passed in the payload POST /products/attributes/{attribute-code}/options is being saved / used nowhere in DB tables as well: eav_attribute_option_value, eav_attribute_option, eav_attribute, catalog_product_entity_varchar and catalog_product_entity_int
The options are stored in eav_attribute_option_value
DB table. Here option_id
is the response retrieved from the POST request and value is the label passed in payload and the actual value passed in the payload request is being ignored but as per Magento docs, value
parameter can be passed in the request which is existing behavior of Magento but however this is not a mandatory field to be passed in the payload. No behavior change is observed even if value
parameter is not passed in the payload request. Hence we can consider this as an enhancement to remove the value parameter in the payload and label as feature request.
Any updates on this?
I am having the same issue and it is quite vital to synchronize product options from an external system to Magento. Unfortunately, as everything on Adobe/Magento takes years :(
@engcom-November @engcom-Hotel
In fact, this value required by this endpoint, is being used for swatch attribute, as swatch attribute option value: eav_attribute_option_swatch.value
in database
private function setSwatchAttributeOption(
AttributeInterface $attribute,
AttributeOptionInterface $option,
string $optionId
): void {
$optionsValue = trim($option->getValue() ?: '');
if ($this->swatchHelper->isVisualSwatch($attribute)) {
$attribute->setData('swatchvisual', ['value' => [$optionId => $optionsValue]]);
} else {
$options = [];
$options['value'][$optionId][Store::DEFAULT_STORE_ID] = $optionsValue;
if (is_array($option->getStoreLabels())) {
foreach ($option->getStoreLabels() as $label) {
if (!isset($options['value'][$optionId][$label->getStoreId()])) {
$options['value'][$optionId][$label->getStoreId()] = null;
}
}
}
$attribute->setData('swatchtext', $options);
}
}
It means it sets this value as swatch text, displayed as on the picture:
Preconditions and environment
Steps to reproduce
POST products/attributes/{attributeCode}/options
Expected result
When I call this REST API endpoint:
GET products/attributes/{attributeCode}/options
in the result array I expect to obtain an option like this:Actual result
when the POST enpoint create the new option, it ignores the value. This is the created option:
where '123' is the progressive option ID.
Additional information
Here is the official enpoint documentation:
https://adobe-commerce.redoc.ly/2.4.5-admin/tag/productsattributesattributeCodeoptions#operation/PostV1ProductsAttributesAttributeCodeOptions
as you can see label and value are mandatory, but value is totally ignored.
Release note
No response
Triage and priority