-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to unselect all multiselect values #7687
Comments
@fooman gave the input that probably the |
On a side note, the method |
More info in case it's useful: the property
|
It seems that same problem exists with configuration multiselects. For example |
Hi @Vinai , thanks for reporting this issue. We have internal ticket MAGETWO-57607 to track this issue on our side. Best, |
It happens also on custom attributes with custom sources. I have put Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend as backend_model . When i save in backoffice without options, i have a string in the before save with the previous options selected. |
@antboiko Any update on this issue? A Magento Enterprise merchant I'm working with is experiencing this issue and they're looking for a patch. Before emailing support for a patch, I wanted to see if this was fixed in develop so that I can grab a patch? |
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687
…ultiple select attribute #7687 - Fix JS unit test.
Bugs - MAGETWO-63022 [2.2] SCD does not work when multiple languages are specified. - MAGETWO-62276 'State/Province' isn't changed to input after selecting 'United Kingdom' while filling address on checkout - MAGETWO-63009 Jasmine test randomly fails on bamboo - MAGETWO-54733 Unable to save product with all unchecked values for multiple select attribute #7687 - MAGETWO-59966 [SWAT][Magento Cloud] - Cache-miss when Fastly is enabled - MAGETWO-60258 [Magento Cloud] - Product position set in the admin is not honored in the category when seen in the Frontend
Any update on this? |
I'd like to know how to get this fixed. It's driving me nuts. (Tested on both 2.1.2 and 2.1.6) |
Bug is still present in 2.1.5. |
Seems like duplicate of #6253 #6281 #4545 |
@veloraven @magento-engcom-team Do you know where this was fixed for the 2.1 branch? I see the backport commit here but this does not fix the issue for me (introduces a new issue): 7ec8952 If there's a better place for me to describe the issue please let me know. |
This issue still persist in Magento ver. 2.2.2 |
Still present in Magento ver. 2.2.3 |
I had the same issue because of multiselect having an empty value (ie. equal to '' or 0 or null) : <select multiple="" class="admin__control-multiselect" data-bind="
attr: {
name: inputName,
id: uid,
size: size ? size : '6',
disabled: disabled,
'aria-describedby': noticeId,
placeholder: placeholder
},
hasFocus: focused,
optgroup: options,
selectedOptions: value,
optionsValue: 'value',
optionsText: 'label'" name="product[customer_group]" id="MEAKNUP" size="6" aria-describedby="notice-MEAKNUP">
<option data-title="NOT LOGGED IN" value="0">NOT LOGGED IN</option> <!-- here is the devil -->
<option data-title="General" value="1">General</option>
<option data-title="Conseillère" value="2">Conseillère</option>
</select> Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter prepare your attributes before saving it. public function prepareProductAttributes(Product $product, array $productData, array $useDefaults)
{
foreach ($productData as $attribute => $value) {
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
if ($value === '' && $considerUseDefaultsAttribute) {
/** @var $product Product */
if ((bool)$product->getData($attribute) === (bool)$value) {
unset($productData[$attribute]);
}
}
}
return $productData;
} When a posted value is equal to empty string ('') it will compare it to the product value before saving. In our specific case, we fixed it using a plugin to restore the value after the prepareProductAttributes function has been called. I hope it will help. |
Why this issue is closed? |
|
Still this issue also persist at magento 2.2.4 . Have done with Vinai describe scenario and same issue is happening @Vinai ,Is this issue resolved at your end? @magento/community-engineering-team ,Can you please check this issue again |
I hope this will help someone. <type name="\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter">
<plugin name="Vendor_Module::prepareProductAttributes" type="\Vendor\Module\Plugin\Product\AttributeFilter"/>
</type> Plugin\AttributeFilter.php use \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter as AttributeFilterHelper;
public function afterPrepareProductAttributes(AttributeFilterHelper $subject, $result, $product, $productData)
{
foreach ($productData as $attribute => $value) {
$pos = strripos($attribute, '-prepared-for-send');
if ($pos === false) {
continue;
}
$attr = substr($attribute, 0, $pos);
if (isset($result[$attr])) {
continue;
}
$result[$attr] = '';
}
return $result;
} |
@engcom-backlog-nazar @engcom-backlog-nickolas could you please recheck if this issue still there? |
@ihor-sviziev, ok i will re check this issue |
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
@ihor-sviziev seems like this already fixed in 2.3.0 release |
@engcom-backlog-nazar
|
@aurelius15 same with
|
@engcom-backlog-nazar did you checked this issue on 2.2 release line? |
@ihor-sviziev yes, same on 2.2-develop |
@ihor-sviziev can we close this issue ? |
@engcom-backlog-nazar sure, if we can’t reproduce this issue |
I cannot find the fix. |
i have the same issue for the 2.2.8.. Does the 2.2.x have a fix for that? we are unable to unselect all values :'( |
Still an issue on 2.3.5 I'm facing same issue. key pair value not set in the post when all values are deselected. |
It works on vendor\magento\module-payment\etc\adminhtml\system.xml |
Magento version: 2.1.2
It is not possible to unselect and save all multiselect attribute values for a product.
After the save completes the state of the product attribute before the product was saved is unchanged.
It seems the problem is that the JS does not submit multiselect form elements with no selected values, at least on the server side completely unselected multiselect attribtues are not part of the
$_POST['product']
array.The exact same issue existed for years on M1 but was finally fixed there. It seems like this issue was introduced again for M2.
Preconditions
None special.
Steps to reproduce
features_bag
orstrap_bags
attributes).Expected result
The product attribute should have no value for the product.
Actual result
The previously selected product attributes still are selected.
The text was updated successfully, but these errors were encountered: