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

Improve error message of product required option by including option … #1466

Merged

Conversation

kiatng
Copy link
Contributor

@kiatng kiatng commented Feb 18, 2021

…title.

Description (*)

If a product has lots of custom options, and when server-side validation fail on a required option, it is useful to know which option failed the validation, like this:

image

The above error message was taken from frontend cart page after the change.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes OpenMage/magento-lts#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

@github-actions github-actions bot added Component: Catalog Relates to Mage_Catalog translations Relates to app/locale labels Feb 18, 2021
@addison74
Copy link
Contributor

By default when there are no options selected in product page when you press the [Add to Cart] button Magento will highlight all options and displays a red message bellow. If there are options selected already only those not selected will be highlighted. This is coming from client side based on JS validation.

A few issues related to this commit:

  • What happens when there are more than one option unselected? Will the error message list all unselected options?
  • An new option is configuration is a must having the option to choose between the default behavior or this one.

@kiatng
Copy link
Contributor Author

kiatng commented Feb 19, 2021

A few issues related to this commit:

  • What happens when there are more than one option unselected? Will the error message list all unselected options?
  • An new option is configuration is a must having the option to choose between the default behavior or this one.

My intention is not to change the existing behavior on server-side validation, only provide better error message for users. There are 2 use cases:

  1. When setting or adding new required options to an existing product. If the carts contain the product without the new options, the errors will be thrown and shown on frontend cart page. This is useful in my case where a product may have > 50 options.
  2. For developers dealing with frontend product and cart pages, while the logic of the products are still being developed and tested. The error message with option title is very useful for me and testers.

@Flyingmana Flyingmana merged commit 658bc54 into OpenMage:1.9.4.x Apr 29, 2021
@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
6 runs  +4  4 ✔️ +2  0 💤 ±0  2 ❌ +2 

Results for commit 658bc54. ± Comparison against base commit 39f9b0e.

@kiatng kiatng deleted the improve_required_option_error_message branch February 27, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Relates to Mage_Catalog translations Relates to app/locale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants