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

Fix bug in admin interface where Bundle Option Is Required setting is not loaded. #3014

Merged

Conversation

rfeese
Copy link
Contributor

@rfeese rfeese commented Feb 7, 2023

Description (*)

This fixes a bug in the admin area when editing Bundle Items Options on a Bundle type product. When "Is Required" on an Option is set to No, the select element on the screen is not initialized with the selected value from the database because of an oversight in the check for existence of a variable with value zero (in the case of Is Required = "No").

Related Pull Requests

Fixed Issues (if relevant)

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

Manual testing scenarios (*)

  1. In Admin interface, Create or Edit a Bundle type product.
  2. On the "Bundle Items" tab, Create / Edit an existing Option.
  3. Change the Option "Is Required" setting to "No".
  4. Save and Continue Edit or Save and return to Edit the product.
  5. Notice that the "Is Required" setting reverts back to "Yes" (the first option).

This happens because the javascript that initializes the "Is Required" select element only runs if the value is "Yes" (1) due to the code checking the value of the variable -- "No" (0) evaluates to false.

Note that the Is Required setting is saved correctly based on what currently shows in the Admin screen (Is Required will be set to Yes unless you change it before saving), and appears to be handled correctly in the customer view.

Questions or comments

I think that the intention of the code was to check for the existence of the variable, so I modified the check to look for whether the variable was defined using typeof.

I suspect this type of problem could show up in other places, but have not attempted to find other instances of this yet.

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)
  • Add yourself to contributors list

…is zero. Fixes the bug where admin screen didn't load the Is Required setting on Bundle Options.
@github-actions github-actions bot added Component: Adminhtml Relates to Mage_Adminhtml Component: Bundle Relates to Mage_Bundle Template : admin Relates to admin template labels Feb 7, 2023
@addison74
Copy link
Contributor

LGTM

Copy link
Member

@elidrissidev elidrissidev left a comment

Choose a reason for hiding this comment

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

Good find. Works as intended.

@fballiano fballiano merged commit 653dde7 into OpenMage:1.9.4.x Feb 7, 2023
fballiano pushed a commit that referenced this pull request Feb 7, 2023
@fballiano
Copy link
Contributor

merged and cherrypicked to 20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Adminhtml Relates to Mage_Adminhtml Component: Bundle Relates to Mage_Bundle Template : admin Relates to admin template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants