Skip to content

Fix #24091 - Selected configurable product attribute options are not displaying in wishlist page. #28157

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

Conversation

Bartlomiejsz
Copy link
Contributor

@Bartlomiejsz Bartlomiejsz commented May 8, 2020

Description (*)

This fixes #24091 and #22503
The reason of the issue is that in add-to-wishlist.js there are event observers that are being triggered on for every configurable product on page after modifying one of them. So if the last product on page doesn't contain any option checked, no matter which will be added to wishlist, it won't contain options.

Related Pull Requests

Fixed Issues (if relevant)

Fixes #22503
Fixes #24091

Manual testing scenarios (*)

Check fixed issues for steps to test

  1. Created two Configurable Product
  2. The born products must be with one or more 'VisualSwatchOption', and related to one category.
  3. Go to Category Page
  4. Select 'VisualSwatchOption' for a first product in the list category and add to Wishlist
  5. For added product must be present 'See Details' on Wishlist page

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)

@m2-assistant
Copy link

m2-assistant bot commented May 8, 2020

Hi @Bartlomiejsz. 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.

@Bartlomiejsz Bartlomiejsz force-pushed the feature/fix_24091_configurable_product_options_on_wishlist branch from 96efff4 to 93372ea Compare May 8, 2020 11:51
@Bartlomiejsz Bartlomiejsz force-pushed the feature/fix_24091_configurable_product_options_on_wishlist branch from 93372ea to a128f39 Compare May 8, 2020 13:23
@ghost ghost added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Jun 25, 2020
Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

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

Hi @Bartlomiejsz thanks for the pull request, it looks great! Looking at the problem, I believe we can solve this just on the JS part, follow below my thoughts:

Since the _updateWishlistData is triggered by an event, we have the event.target that is the selector of the option that the user has changed within the product block (it can be the product page or an item within a product list), from that perspective we can extract the selected attribute values from the correct product and also on _updateAddToWishlistButton we can update the post data on the right add-to-wishlist element.

Using this approach, it won't be a need to have an object dataToAdd with productId, since the event gives us the context that we need to collect the data from the right product and update it's form.

We would still have to have some mechanism to figure out if we are on list or product page, but I think that can be done on JS as well, what do you think?

Please let me know if there are any questions.

@Bartlomiejsz
Copy link
Contributor Author

Hi @gabrieldagama, that is great idea to limit execution of wishlist button update to only current product instead of lopping for every item possible. I managed to reduce js needed for it and also accomplish that, thank you.

However I'm not sure if checking if current page is product list via js is good idea.
This might cause some issues easier on modified themes with different structure/classes, and by assuming that we're checking i.e. body class - in the core there are already two possibilities (catalog-category-view, catalogsearch-result-index), and if somebody would like to add some custom products list page it would require to rewrite wishlist js just to make it work by adding additional class to check. With current solution this is only about adding one additional parameter to block.
Also, current solution is consistent with final price renderer, which is already part of the core.

Could you please check current solution after my changes and let me know what do you think?

Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

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

Hi @Bartlomiejsz, thanks for the updates! Agree with your arguments there, please follow some very small suggestions to keep consistency, also we must cover all PRs will tests, the add-to-wishlist has a jasmine test that may need to be updated based on the changes and it would be great if we can cover this with MFTF tests, let me know if you need any help with the tests!

Thanks!

@gabrieldagama
Copy link
Contributor

@magento run all tests

@engcom-Echo
Copy link
Contributor

Hi @Bartlomiejsz. I'll take care of the test coverage if you don't mind.

@Bartlomiejsz
Copy link
Contributor Author

@engcom-Echo i would not be able to do it this week so that's great, thank you!

@engcom-Echo
Copy link
Contributor

@magento run all tests

@engcom-Echo engcom-Echo self-assigned this Aug 16, 2020
@engcom-Echo
Copy link
Contributor

@magento run all tests

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests B2B

1 similar comment
@engcom-Echo
Copy link
Contributor

@magento run Functional Tests B2B

@gabrieldagama
Copy link
Contributor

@magento give me test instance with edition ee

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@gabrieldagama
Copy link
Contributor

@magento give me new instance with edition b2b

@magento-deployment-service
Copy link

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

@magento-deployment-service
Copy link

@gabrieldagama
Copy link
Contributor

@magento run all tests

@gabrieldagama
Copy link
Contributor

@magento run all tests

Gabriel Galvao da Gama added 2 commits October 14, 2020 14:25
…ist' of github.com:Bartlomiejsz/magento2 into feature/fix_24091_configurable_product_options_on_wishlist
@gabrieldagama
Copy link
Contributor

@magento run all tests

1 similar comment
@gabrieldagama
Copy link
Contributor

@magento run all tests

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Preconditions:

Magento 2.4-develop with sample data

Case 1

Manual testing scenario:

  1. Log into the customer account.
  2. Navigate to the product listing page.
  3. Choose the configurable product and select preferred color and size options of any product expect last product which is listed in Product listing page ( It is working fine for last product of the listing page).
  4. Click on the wishlist icon of the product.

Before: ✖️ The selected color and size is not visible in the wishlist page.

Peek 2020-10-15 15-08

After: ✔️ The selected color and size is visible in the wishlist page.

Peek 2020-10-15 15-02

Case 2

Manual testing scenario:

  1. Log into the customer account.
  2. Navigate to product listing page.
  3. choose the configurable product and select preferred color and size options.
  4. click on the wishlist icon of another configurable product on the same page without selecting any color/size options.
    For example:

qa-contribution

After: ✔️ the system didn't assign different product options to the wishlist product.

Peek 2020-10-15 15-03

@gabrieldagama
Copy link
Contributor

@magento run Functional Tests B2B,Functional Tests EE

@ghost ghost added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Oct 21, 2020
magento-engcom-team pushed a commit that referenced this pull request Oct 21, 2020
@magento-engcom-team magento-engcom-team merged commit 7775a51 into magento:2.4-develop Oct 21, 2020
@m2-assistant
Copy link

m2-assistant bot commented Oct 21, 2020

Hi @Bartlomiejsz, 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
Area: Frontend Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Swatches Component: Wishlist Partner: Fast White Cat partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Priority: P3 May be fixed according to the position in the backlog. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Selected configurable product attribute options are not displaying in wishlist page. Added Wish-list product displaying with wrong configurations
5 participants