Skip to content
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

ISSUE-28814 - Ensure MSRP info on gesture always works #31903

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from

Conversation

zaximus84
Copy link

@zaximus84 zaximus84 commented Jan 29, 2021

Description (*)

When MSRP is enabled and a product is set to show price on gesture, the MSRP javascript relies on an MSRP popup template being present on the page (<script data-role="msrp-popup-template" type="text/x-magento-template">). If that template is not present, there is a js error and the info popup won't be shown on click.

The MSRP module adds the popup template to layout handles where products are expected (category view, product view, cart, etc.). However, products can be added to virtually any page via CMS content / widgets, so any page outside the expected list will not have gesture functionality.

This PR removes the popup from specific layout handles and instead adds it to default so it's rendered on every page. However, an ifconfig attribute is added to the popup block so that it will only be processed if MSRP is enabled.

Fixed Issues (if relevant)

  1. Fixes Minimum Advertised Price "show on Gesture" does not work for CMS pages other than Homepage and when the same product appears twice on a page #28814

Manual testing scenarios (*)

  1. Enable MSRP in admin configuration (Sales > Minimum Advertised Price > Enable MAP).
  2. Edit a product. In advanced pricing, set a MAP price greater than the product's price and set Display Actual Price to On Gesture.
  3. Visit a category containing that product. Click "Click for price" and confirm it shows the price information. (this was working before and should continue to work)
  4. In admin, edit a CMS page and insert a Catalog Products List widget. Set the conditions so the MAP product will be displayed in the list and save the CMS page.
  5. Visit the CMS page on the store front. Click "Click for price" on the product and confirm it shows the price information. (this was NO working before)

Questions or comments

There were several options to fix this issue:

  1. Consider support for MSRP on additional pages (such as non-home CMS pages) to be beyond the scope of the native application. Merchants must add theme customizations to add the popup to layout handles where they desire to show products with MSRP. I consider this viewpoint invalid. The feature is broken as long as "Click for price" is present but doesn't work.
  2. Attempt some kind of registry model to track whether an MSRP block has been rendered for a product. Add a new block at the bottom of the page that checks the registry and renders the popup block if MSRP was ever rendered. This will ensure that the popup block is output when MSRP is present on the page, and not output if there was no MSRP. This is overly complicated and block caching could produce scenarios where MSRP is rendered in cached content but the popup template is not rendered.
  3. Load the template via js / ajax. This could be done always (instead of the current behavior of embedding it in the page), or as a fallback if the popup isn't already found on the page (such as non-home CMS pages).

In the end, none of these seemed like good solutions compared to just adding the block to every page.

Additional note: Issue #28814 mentions a second case where MAP gesture doesn't work; any time the same MAP product is displayed twice on the same page. I was unable to reproduce that use case.

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 Jan 29, 2021

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

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

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

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-community-project m2-community-project bot added Priority: P3 May be fixed according to the position in the backlog. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Component: Msrp Partner: Blue Acorn iCi partners-contribution Pull Request is created by Magento Partner Priority: P3 May be fixed according to the position in the backlog. Progress: pending review Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
2 participants