Skip to content

Fix bug 26449: Configurable product attribute issue #27339

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

Merged
merged 18 commits into from
Jun 13, 2020

Conversation

tna274
Copy link
Contributor

@tna274 tna274 commented Mar 18, 2020

Description (*)

Fix bug 26449: when creating a new configurable product, configuration options attribute of parent product still have value

Related Pull Requests

N/A

Fixed Issues (if relevant)

  1. Fixes Configurable product attribute issue #26449: Configurable product attribute issue

Manual testing scenarios (*)

  1. Log into the admin account.
  2. Navigate to Catalog > Products.
  3. In add new product dropdown choose configurable product and create a configurable product using “Size” attribute:-
  4. One of those variants value('Size') must be set default

Screenshot_22

image

  1. After saving product, the value of "Size" attribute will be set null

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

- Set null for configurable options of parent product whenever it's saved
@m2-assistant
Copy link

m2-assistant bot commented Mar 18, 2020

Hi @tna274. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

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

@ghost ghost assigned kandy Mar 18, 2020
@edenduong edenduong self-assigned this Mar 20, 2020
@edenduong edenduong added Award: bug fix Auto-Tests: Covered All changes in Pull Request is covered by auto-tests labels Mar 20, 2020
Copy link
Contributor

@edenduong edenduong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tna274 : Please check the Unit Test. It is failed now. Please run vendor/bin/phpunit app/code/Magento/ConfigurableProduct/Test/Unit/Plugin/Model/ResourceModel/ProductTest.php to check the error of Unit Test. Thanks.

image

@tna274
Copy link
Contributor Author

tna274 commented Mar 22, 2020

Hi @edenduong
I have updated code to fix the unit test

Copy link
Contributor

@edenduong edenduong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method $object->setData($optionAttribute->getAttributeCode(), null); (and the logic in if block) is not covered by Unit Test. Please mockupgetExtensionAttributes , to cover the if block.
Thank you.

@tna274
Copy link
Contributor Author

tna274 commented Mar 25, 2020

Hi @edenduong
I have updated unit test

Copy link
Contributor

@edenduong edenduong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tna274 : Please check my comment

  • Remove redundant code
  • use instead of full class name
  • Mock object should be declare as postfix mock like searchCriteriaBuilderMock

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE

@magento-engcom-team
Copy link
Contributor

Hi @VladimirZaets, thank you for the review.
ENGCOM-7214 has been created to process this Pull Request

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Go to Admin->Catalog->Products->Add Configurable Product;
  2. Fill all required fields and click on Create Configurations->Create New Attribute;
  3. Create text swatch attribute "Size" and set value s -> Is Default;
    Screenshot from 2020-05-19 16-40-04
    Screenshot from 2020-05-19 16-40-29
  4. Save Attribute and go to the next step;
  5. Select all options expect s (default);
    Screenshot from 2020-05-19 16-41-56
  6. Generate products and Save product
    Screenshot from 2020-05-19 16-44-35
  7. Go to Storefront -> category with created before product;

Before:
✖️ S Size assigned parent configurable product automatically and visible in filter result on category page when user select size S. That is the wrong functionality.

Peek 2020-05-19 16-55

After:
✔️ Size attribute assigned to parent configurable product, so once user filter the product on a category page using S size, this product does not show in filter result.
screenshot_16

@engcom-Alfa engcom-Alfa self-assigned this May 19, 2020
@VladimirZaets VladimirZaets added Progress: accept QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) and removed Progress: extended testing Progress: accept labels May 20, 2020
@engcom-Alfa engcom-Alfa added QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Jun 10, 2020
@engcom-Echo
Copy link
Contributor

@magento run all tests

@m2-assistant
Copy link

m2-assistant bot commented Jun 13, 2020

Hi @tna274, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Component: Catalog Component: ConfigurableProduct Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Configurable product attribute issue
10 participants