Advanced/Tier Pricing thousand separators corrupt quantities on save (e.g. qty of 1,000 on save becomes 1)
Bug is apparent in version 2.1, I have not checked earlier versions.
System set to a language that uses , (comma) as a thousands separator.
When creating a product with a advanced/tiered pricing structure, naturally, quantities of 1000 or above may be required. However, if a product is revisited and saved the quantities of 1000 and above are truncated at the displayed thousands separator: 1,000 becomes 1, 2,000 becomes 2, etc.
Steps to reproduce are:
- Create or open a product
- Open Advanced pricing and create tiered pricing entries with 'Quantity' set to 1000 or above.
- Save and close the product
- Re-open the product, save and close the product (there is no need to open the 'Advanced Pricing' Panel)
- Re-open the product, open the 'Advanced Pricing' panel. All quantities of 1000 and above will have been truncated.
Additionally, the same bug affects the 'weight' field
Duplicate of https://github.com/magento/magento2/issues/5745
This issue can be corrected temporarily (until an official bug release) by amending lines 107 and 108 of General.php
This file can be found in the generally (composer or downloaded from webste) installed version, at:
vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/General.php
or in the version on GitHub at:
app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php
Change:
$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY] = $this->formatNumber((int)$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY]);
to
$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY] = (int)$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY];
This is for Magento 2.1. I have not as yet looked into the weight field.
Do not simply comment out the line as the casting to an int is required.
@Part-A Technically the QTY field doesn't have to be an int, it can be a float as well. To convert to a number, do $value * 1.
To add to it, if you upload advanced pricing using csv ( bulk upload ) then go a head and view the same product in the catalog --> product section --> Advanced Pricing . It shows with thousands separator now try to save.
Expected Result Product should be saved. Actual Result We found a duplicate website, tier price, customer group and quantity.
Closed as duplicate #5745 Issue has been fixed