Magento2: "Use Default Value" gets unchecked, when product data is saved

Created on 3 May 2017  路  52Comments  路  Source: magento/magento2

Preconditions

  1. CE 2.1.4

Steps to reproduce

  1. Open a product in Admin, select a store view, say Default Store View
  2. Check any of the 'Use Default Value' checkboxes in 'Search Engine Optimisation'(or any) tab and save product.
  3. Click on the Save button to save the product again, without opening/loading the 'Search Engine Optimisation' accordion tab

Expected result

  1. The check boxes must be checked and unchecked as specified.

Actual result

  1. All the checkboxes inside accordions which are not opened/loaded will be reverted to unchecked state.
Backend distributed-cd mm19pl Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.3.x bug report

Most helpful comment

Any update on this? It's really important, our customers are getting mad while doing data entry

All 52 comments

@justinsyatnam Thanks for reporting this issue. Created internal issue MAGETWO-70217 to investigate and track this issue.

same here 2.1.8

@justinsyatnam, thank you for your report.
We've created internal ticket(s) MAGETWO-70217 to track progress on the issue.

Can also replicate, here is a gif for clarity:

price

Any update on this? It's really important, our customers are getting mad while doing data entry

distributed-cd

@ansukhorukova thank you for joining. Please accept team invitation here and self-assign the issue.

distributed-cd

@Deep256 thank you for joining. Please accept team invitation here and self-assign the issue.

See here for a patch: https://www.cadence-labs.com/2018/03/magento-2-use-default-value-store-view-scope-fix/

The associated module should fix the issue which comes from the url_key autogenerator (for url_key attribute) and then the general issue of attributes in non-opened tabs not having their "use_default_value" flag sent to the server

This bug occurs even if we have enabled simple store mode. Even in this case product attribute values copies on some actions (maybe save or duplicate, not detected yet) with store_id=1.

Hi, the issue is still here on magento 2.2.5

nobody is able to solve this issue ?

Can somebody re-test this on Magento 2.2.6 or 2.2.7? I believe it was fixed in 2.2.6 based on some commits I saw passing by, but I never verified this myself.

It's not fixed in 2.2.6 still dealing with this issue

yes i check in 2.2.6 i also get same issue .. i cant find solution of it

Ok, sorry to disappoint (?) the people above, but this really is fixed in 2.2.6 and 2.2.7, and also in 2.3.0.

So I just put some time in this, setup clean Magento 2.2.5, 2.2.6, 2.2.7 and 2.3.0 installations and followed the exact steps as outlined by @justinsyatnam on each one of them.
In Magento 2.2.5 I can fully reproduce the problem, but in 2.2.6, 2.2.7 and 2.3.0 the issue is definitely fixed.

My guess is that for the people saying it's not fixed, is that they only test it on products which already have the problem. Upgrading to 2.2.6 will not fix the issue for products which already have the problem, since incorrect data is already stored in the database. The fix will only work for new products created in 2.2.6 or for older products which didn't already have the problem.

Closing the issue.

If someone can prove me wrong by outlining exact steps to reproduce the problem on a clean Magento installation, please go ahead and we can then re-open the issue.

Ok, sorry to disappoint (?) the people above, but this really is fixed in 2.2.6 and 2.2.7, and also in 2.3.0.

So I just put some time in this, setup clean Magento 2.2.5, 2.2.6, 2.2.7 and 2.3.0 installations and followed the exact steps as outlined by @justinsyatnam on each one of them.
In Magento 2.2.5 I can fully reproduce the problem, but in 2.2.6, 2.2.7 and 2.3.0 the issue is definitely fixed.

My guess is that for the people saying it's not fixed, is that they only test it on products which already have the problem. Upgrading to 2.2.6 will not fix the issue for products which already have the problem, since incorrect data is already stored in the database. The fix will only work for new products created in 2.2.6 or for older products which didn't already have the problem.

Closing the issue.

If someone can prove me wrong by outlining exact steps to reproduce the problem on a clean Magento installation, please go ahead and we can then re-open the issue.

check this link i have upload video of my issue you will check i have magento 2.2.7 still got the issue and i create new product as you se in video
https://streamable.com/i4xa2

Thanks for the video @warrior7789! This is not what I saw when I tested 2.2.7, but I'll try to redo the test later today and see if it behaves the same as with you or not.

but if you install fresh magento 2.2.6 . its work perfectly but i have upgrade magento 2.1.8 to 2.2.7

The error i found is while you save i print the data which i get is

this is Default magento 2.2.6 here we get [use_default] => Array
default2 2 6

this isupgrade from 2.18 to 2.2.6 here i dont get [use_default] => Array
myupdate

I don't think it's right to mark the issue as closed if upgrading the magento version is not enough to fix it. We cannot install a fresh version any time a new bug is fixed, we can only upgrade the version we have, so if the fix does not work by upgrading then the issue is not fixed therefore it should not be closed in my opinion

@hostep I agree with @LouNik1984 - If Magento's stance on this is "You installed Magento 2 before 2.2.6 so just live with it" that is pretty poor.

The issue is not fixed for the huge majority of Magento 2 customers therefore the issue should not be closed.

Sure, re-opening, but would anyone be so kind to add exact steps to reproduce, like: setup a clean Magento 2.1.x store, do A, B and C, then upgrade to 2.2.7, and perform D, E and F to demonstrate the problem. That would be very helpful!

I can't be sure about how people's stores are setup, with all kinds of custom code (patches, modules, ...) which might influence this behaviour, therefore finding exact steps to reproduce on a vanilla installation is preferred.

@hostep I agree with @LouNik1984 - If Magento's stance on this is "You installed Magento 2 before 2.2.6 so just live with it" that is pretty poor.

The issue is not fixed for the huge majority of Magento 2 customers therefore the issue should not be closed.

hi @BenSpace48 did you get any solution ? i found issue that is will not send use_default value while you submit the form

finally i got the solution by adding new code in form.js this is temporary solution for right now.
1) /vendor/magento/module-ui/view/base/web/js/form/form.js
code we add

find this submit function add my code

submit: function (redirect) {
var additional = collectData(this.additionalFields),
source = this.source;

        _.each(additional, function (value, name) {
            source.set('data.' + name, value);
        });

        **// HACK for product - use default value...
            if($('input[name="product[name]"]').length){
                // source.set('data.use_default[name]', 1);
                $(".admin__field-service").each(function(i, v){
                    if($(this).find("input").attr("type") == "checkbox"){
                        var name = $(this).find("input").attr("name");
                        var checked = $(this).find("input").prop("checked");
                        var value = 0;
                        if(checked){
                            value = 1;
                        }
                        source.set('data.'+name, value);
                    }
                });
            }
        // HACK for product - use default value...**

        source.save({
            redirect: redirect,
            ajaxSave: this.ajaxSave,
            ajaxSaveType: this.ajaxSaveType,
            response: {
                data: this.responseData,
                status: this.responseStatus
            },
            attributes: {
                id: this.namespace
            }
        });
    },

I'm not currently working on Magento so I'm unable to test or debug sorry, as far as I'm aware we still have the issue with no workaround.

I would advise overwriting or extending that file rather than editing the core.

What is the status of this issue?

Updateing products on storeview level using REST API also unchecks al the boxes.
Even those who we didnt touch.

Any update on this issue? It happens when I check "Use Default Value" on store view and click save. The checkbox remains unchecked.

@dwaynebartels: as far as I'm aware this got fixed in 2.2.6 for the adminhtml "use default value" checkboxes. But some people in here commented this isn't true but then fail to provide exact steps to reproduce on 2.2.6 or 2.2.7, so the status is a bit unknown at the moment I'm afraid.

As for REST API calls, that's a different bug, you can follow these issues:

Based on the code, this issue appears to have been fixed - you can see the history here: https://github.com/magento/magento2/commits/2.2/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/AttributeFilter.php

The addition of the isAttributeShouldNotBeUpdated method is meant to address this issue (I believe).

@magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.

Hi @mohith227. Thank you for your request. I'm working on Magento 2.2-develop instance to deploy test instance for you

@magento-engcom-team this issue is already fixed in 2.3-develop

Hi @justinsamuel92, @ansukhorukova, @Deep256.

Thank you for your report and collaboration!

The related internal Jira ticket MAGETWO-70217 was closed as non-reproducible in 2.3.x.
It means that Magento team either unable to reproduce this issue using provided _Steps to Reproduce_ from the _Description section_ on clean or the issue has been already fixed in the scope of other tasks.

But if you still run into this problem please update or provide additional information/steps/preconditions in the _Description section_ and reopen this issue.

Can confirm that this is still an issue in Magento 2.3.1.

Steps to reproduce;
Assign an existing product to a new website.
Try changing product attributes (for example 'name') to 'use default value'.
Save the product

Expected result: Product attribute is saved with the use default value checkbox.

Actual result: Product attribute is not saved with the use default value checkbox.

Also, the js change submitted by @warrior7789 works for this issue.

Hi @engcom-Charlie. 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:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Charlie Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • [ ] Add "Component: " label(s) to this ticket based on verification result. If uncertain, you may follow the best guess

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

:white_check_mark: Confirmed by @engcom-Charlie
Thank you for verifying the issue. Based on the provided information internal tickets MC-17995 were created

Issue Available: @engcom-Charlie, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

nmalecki #mm19pl

@nmalecki thank you for joining. Please accept team invitation here and self-assign the issue.

Hi @nmalecki. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [x] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [x] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


looks like this issue is already fixed in 2.3-develop

Yeah, this was fixed in 2.2.6 I believe, let's close this since nobody is able to provide steps to reproduce the problem.

I have multistore on Magento 2.2.9 and after installing Cadence module (and also without it) the problem still exist. When i checked "Use deafult value" on one of the stores, and click "Save", page is refreshed and checkbox is still nonchecked. I test it on Magento 2.3.2 and there is no problem, but can someone help me and tell what change in code of M 2.2.9 (without upgrading to 2.3.2) to get this fix?

The issue persist on Magento 2.3.3
Screenshot 2019-12-18 at 21 28 33

@tushhan Can you add steps to replicate on a vanilla instance of Magento 2.3.3 please? If you do this ticket can hopefully be re-opened.

I am also having this in Magento 2.3.3

@webspeaks or @tushhan: please open a new issue with exact steps about how to reproduce, because the bug as reported by @justinsamuel92 should no longer occur in Magento 2.3.3:

All the checkboxes inside accordions which are not opened/loaded will be reverted to unchecked state.

If you've found a way to trigger it again, more information would be appreciated, thanks!

@hostep @tushhan @BenSpace48 Can you please check for the issue in both a vanilla instance and an upgraded instance? I think this only works in vanilla

@justinsamuel92: please give exact steps to reproduce, we can't just at random try something out and hope the bug will trigger (if it still exists), thanks!

@hostep All I can tell right now is that we migrated from Magento 1.9 to Magento 2.2. The site was running fine till we upgraded to 2.3.3 recently.
Please note that we did all upgrades on time and did necessary upgrades from 2.2 -> -2.3.1 -> 2.3.2 -> 2.3.3
Also the issue occurs even for the opened tabs, like General tab which is always open. Not sure what else I can provide.

@webspeaks: it sounds like a different bug then, the initial bugreport was that the "use default value" checkboxes got incorrectly unchecked when the accordion/tab was closed and you saved the entity without opening one of the accordions/tabs.

What I understand from your issue is that you have the "use default value" checkbox unchecked and by checking it and saving, it remains unchecked, is that correct?

It would be super awesome if you could figure out why that happens and try to reproduce this on a vanilla 2.3.3 installation. Take a look at the values stored in the database, maybe you'll notice something strange there.

I would strongly recommend you to open a new issue if you've figured out the steps to reproduce this problem, as it's not the exact same bug as reported in this issue.

Was this page helpful?
0 / 5 - 0 ratings