magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Configurable Product Not correctly being populated on 2.3.4 #26991

Closed bugbuster2 closed 4 years ago

bugbuster2 commented 4 years ago

Preconditions (*)

  1. Magento 2.3.4

Steps to reproduce (*)

1.Create two separate attribute with a number of options (I had 5 in one and 10 in the 2nd one) 2.Generate configurable options using these two attribute 3 In product edit mode, I try to disable some of the options generated from these two attribute.

Expected result (*)

  1. [Screenshots, logs or description] 2.The disable option should not show on website

Actual result (*)

  1. But instead it randomly removed options from the drop down menu.
m2-assistant[bot] commented 4 years ago

Hi @bugbuster2. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@bugbuster2 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


m2-assistant[bot] commented 4 years ago

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

engcom-Echo commented 4 years ago

Hi, @bugbuster2. Thank you for your report. Unfortunately, I can't reproduce this issue on 2.4-develop. After doing are steps to reproduce, I got the expected result.

image image

Please feel free to comment, reopen or create new ticket according to the Issue reporting guidelines if you are still facing this issue on the latest 2.4-develop branch. Thank you for collaboration.

bugbuster2 commented 4 years ago

Thank you for the reply, but I still have this problem. There must be something simply I am not doing right. I deleted Magento 2.3.4 and installed a fresh copy, change mode to Developer, created a new product with Colour and Size as configurable option, I disable the "FIRST" red option from the list, you can see from the screenshot the problem is that this hides also all the configurable options of RED also from the list. Please advise?

screenshot1

image

acmetech2009 commented 4 years ago

Hi, I've got the same problem on magento 2.3.4. When product page loads with configuration product, browser developer tools do not show any errors but when i choose first option it shows:

Uncaught TypeError: Cannot read property '0' of undefined at $..._fillSelect (configurable.js:449) at $..._fillSelect (widget.js:100) at $..._configureElement (configurable.js:271) at $..._configureElement (widget.js:100) at HTMLSelectElement._configure (configurable.js:254) at HTMLSelectElement. (widget.js:100) at HTMLSelectElement.dispatch (jquery.js:5232) at HTMLSelectElement.elemData.handle (jquery.js:4884) _fillSelect @ configurable.js:449 (anonymous) @ widget.js:100 _configureElement @ configurable.js:271 (anonymous) @ widget.js:100 _configure @ configurable.js:254 (anonymous) @ widget.js:100 dispatch @ jquery.js:5232 elemData.handle @ jquery.js:4884

The next dropdown (that depends on first one) is not populated with values. It worked on previous magento versions. I noticed that on products with one dropdown it works fine.

Any ideas?

DaveSkirrow commented 4 years ago

I'm also having this problem, It's hard to reproduce as it seems to happen randomly and if you mess with the variations in admin sometimes it fixes the product or fixes some of the variations.

DaveSkirrow commented 4 years ago

@magento give me 2.4-develop instance

magento-engcom-team commented 4 years ago

Hi @DaveSkirrow. Thank you for your request. I'm working on Magento 2.4-develop instance for you

magento-engcom-team commented 4 years ago

Hi @DaveSkirrow, here is your Magento instance. Admin access: https://i-26991-2-4-develop.instances.magento-community.engineering/admin_1d2e Login: ae2cb1b1 Password: a56d2ac7ce4c Instance will be terminated in up to 3 hours.

DaveSkirrow commented 4 years ago

@bugbuster2 @acmetech2009

Are either of you able to reproduce in the 2.4 develop instance? I'm unable to reproduce it but I'm unable to fix it in my migrated 2.3.4

DaveSkirrow commented 4 years ago

@magento give me 2.3.4 instance

magento-engcom-team commented 4 years ago

Hi @DaveSkirrow. Thank you for your request. I'm working on Magento 2.3.4 instance for you

magento-engcom-team commented 4 years ago

Hi @DaveSkirrow, here is your Magento instance. Admin access: https://i-26991-2-3-4.instances.magento-community.engineering/admin_2ba1 Login: a96e62e3 Password: 1e2ee0c50461 Instance will be terminated in up to 3 hours.

DaveSkirrow commented 4 years ago

Problem is present in vanilla 2.3.4 and appears to be fixed in 2.4-developer instance so looks like it's been fixed

acmetech2009 commented 4 years ago

Hi DaveSkirrow, May I ask You for patch of this for magento 2.3.4? I would check it on my dev instance. Regards

DaveSkirrow commented 4 years ago

I just used the magento instance generated here with the command @magento give me 2.4-develop instance

magento-engcom-team commented 4 years ago

Hi @DaveSkirrow. Thank you for your request. I'm working on Magento 2.4-develop instance for you

DaveSkirrow commented 4 years ago

In fact that's generated another one which you can use

magento-engcom-team commented 4 years ago

Hi @DaveSkirrow, here is your Magento instance. Admin access: https://i-26991-2-4-develop.instances.magento-community.engineering/admin_4e58 Login: d8b3aca1 Password: 92a386b89cee Instance will be terminated in up to 3 hours.

kestraly commented 4 years ago

Just encountered this same error on a migration. Checking it out

kestraly commented 4 years ago

Switching to swatches for one attribute removes the JS error for me

arnoudhgz commented 4 years ago

Fix can be found here: https://github.com/magento/magento2/commit/f661205a5c5d27e519ad57219cdc1f8d12afe3de#diff-66a1653242fb5ab3e50a207c8743d0dcR445 (last file)

Really weird this is not fixed in 2.3.4...

acmetech2009 commented 4 years ago

Hi arnoudhgz, Your fix works. Thank You very much. It restores only the way it worked in previous magento versions. In my opinion there is still problem. In my case I have 2 attributes. When You select value from 1 attribute and then select value form 2 attribute, and after that You change Your mind and You select another value form 1 attribute, You will get in 2 attribute wrong values. You can check it on my dev here: https://dev.mundurowy.pl/koszula-sluzbowa-policja-krotki-rekaw.html This is matrix of values You should get but You don't when You click as I wrote: Wzrost: 158-170 ; Kolnierzyk: 34, 35, 36 Wzrost: 164-176 ; Kolnierzyk: 37, 38, 39 Wzrost: 170-182 ; Kolnierzyk: 40, 41 Wzrost: 176-188 ; Kolnierzyk: 42, 43, 44, 45, 46, 48, 50, 52 Wzrost: 188-200 ; Kolnierzyk: 42, 43, 44, 45, 46, 48, 50

This is problem that I have with magento 2 form the beginning (I use magento 2 from 09-2017) Maybe it would be an opportunity to improve it?

DaveSkirrow commented 4 years ago

Great! Could anyone tell me if I can use an override file instead of editing the original. And where would this file go, assuming I'm using the default Luma theme?

Acmetech, might be worth opening a new issue for the related/old fault you have found

DaveSkirrow commented 4 years ago

@arnoudhgz Just wondering if you could let me know how to apply the fix? I installed via composer so there was no app/code/magento folder. I have found the original file in the appropriate vendor folder but I'm not sure if it's safe to change it there? Creating app/code/Magento/ConfigurableProduct/view/frontend/web/js/ and adding the file there doesn't do anything

Any help much appreciated!

arnoudhgz commented 4 years ago

@DaveSkirrow you'll need to change the text app/code/Magento/ConfigurableProduct to the vendor location of the configurable product. So vendor/magento/module-configurable-product

DaveSkirrow commented 4 years ago

Thank you! I wasn't sure if it was OK to edit vendor files but I will do that now.

arnoudhgz commented 4 years ago

@DaveSkirrow it is not alright to edit vendor files manually. But you can use git patch to apply a patch to your codebase. So when you do a new deployment you can easily apply the patches again.

xpoback commented 4 years ago

Fix can be found here: f661205#diff-66a1653242fb5ab3e50a207c8743d0dcR445 (last file)

Really weird this is not fixed in 2.3.4...

Nothing weird, it's very typical for Magento to no include fixes that have been already merged to the develop branch to the nearest release. Get used to it :)

xpoback commented 4 years ago

@DaveSkirrow it is not alright to edit vendor files manually. But you can use git patch to apply a patch to your codebase. So when you do a new deployment you can easily apply the patches again.

To simplify this procedure you can use cweagans/composer-patches. The patch will be applied on each composer install/update.

DaveSkirrow commented 4 years ago

@DaveSkirrow it is not alright to edit vendor files manually. But you can use git patch to apply a patch to your codebase. So when you do a new deployment you can easily apply the patches again.

To simplify this procedure you can use cweagans/composer-patches. The patch will be applied on each composer install/update.

Thank you @xpoback. I'd actually already manually edited the vendor file. In this case, will this cause a problem? Will it prevent updates entirely or will the file just be overwritten (and I'll lose my changes) if I try to update?

If the latter, am I right in saying that these changes will most likely be in the next release anyway?

Thanks!

tomzweb commented 4 years ago

If anyone's coming to this a little late, the suggested fix above is included in Magento 2.3.5p-1.

rahulpathakweb commented 3 years ago

Hi Dear,

Please update the configrable.js file only, you will get error free and configrable dropdown will populate 100%. Please upldade 👍 https://github.com/magento/magento2/blob/f661205a5c5d27e519ad57219cdc1f8d12afe3de/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js