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

bugfix: don't cast min_sale_qty to int as it can be a decimal #1207

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

mageconsult
Copy link
Contributor

@mageconsult mageconsult commented Sep 13, 2020

Description (*)

With Magento 1.9.4.2 there was a small change in
app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml.

When selling products with is_qty_decimal set to true, it is possible to sell units lower than one.

Here an example from an actual product in frontend
image

Backend when creating product
image

When creating a product in backend, this will first be save correctly.
image

With next edit it will be casted to integer and the decimal part will be cutted of. A min_sale_qty with 0.25 for example will be casted to 0.
image

With this fix the old version will be introduced again.

Manual testing scenarios (*)

  1. enable is_qty_decimal in product
  2. enter qty of 1.5
  3. set min_sale_qty to 0.25
  4. save and continue edit
  5. min_sale_qty now is still 0.25 (instead of 0)

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)

…_decimal is true. Cast to int was introduced with magento 1.9.4.2
@github-actions github-actions bot added Component: Adminhtml Relates to Mage_Adminhtml Component: Catalog Relates to Mage_Catalog Template : admin Relates to admin template labels Sep 13, 2020
@kkrieger85 kkrieger85 added hacktoberfest easy to solve issues for https://hacktoberfest.digitalocean.com/ participant (and everyone else) hacktoberfest-accepted labels Oct 22, 2020
@kkrieger85 kkrieger85 merged commit a03caa4 into OpenMage:1.9.4.x Oct 22, 2020
@joshua-bn
Copy link
Contributor

joshua-bn commented Oct 22, 2020

Probably would've been better to cast it to a float instead of nothing. Now it could be a non-scalar value or a non-numeric string.

edit: missed the *1. Still, not very explicit why that's there. Should use (float) instead.

@sreichel sreichel added the bug label Dec 27, 2020
@sreichel sreichel added this to the Release 19.4.9 / 20.0.5 milestone Dec 27, 2020
@Flyingmana Flyingmana changed the title bugfix: don't cast min_sale_qty to int as it can be below 1 bugfix: don't cast min_sale_qty to int as it can be a decimal Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component: Adminhtml Relates to Mage_Adminhtml Component: Catalog Relates to Mage_Catalog hacktoberfest easy to solve issues for https://hacktoberfest.digitalocean.com/ participant (and everyone else) hacktoberfest-accepted Template : admin Relates to admin template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants