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

Custom options save wrong price values after editing #6342

Closed
AirmanAJK opened this issue Aug 25, 2016 · 14 comments
Closed

Custom options save wrong price values after editing #6342

AirmanAJK opened this issue Aug 25, 2016 · 14 comments
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@AirmanAJK
Copy link

AirmanAJK commented Aug 25, 2016

Magento CE 2.1.0 using USD as currency.

When product custom options are saved with prices > $999, revisiting the product page will display the "Price" field for custom options using commas to separate thousands (ie 1,500.00 or 1,000.00).

When saving prices with these default values, the first comma is used as the decimal point.
Saving 1,000.00 in a custom options field will store 1.00 in the database.

Steps to reproduce

  1. Create a product and add a custom option price greater than or equal to 1000
  2. Save the product and go to its edit page again.
  3. The new value of the custom option price will 1,000.0
  4. Without changing this value, save the product.
  5. The new value for the custom option price will be 1.00

Expected result

Magento should handle custom option prices on product edit pages as it does for regular product prices.

@antboiko antboiko added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Aug 25, 2016
@antboiko
Copy link

Hi @AirmanAJK , thanks for reporting this issue. We've created internal ticket MAGETWO-57639.

Best,
Anton.

@donky6
Copy link

donky6 commented Sep 20, 2016

Can confirm this issue also exists using $AUD as currency also.
Also not sure if it's related but even if choosing percentage as the option, the value still displays as currency.

@ntkp
Copy link

ntkp commented Sep 26, 2016

This issue also exits with đ - Vietnam dong..

mmansoor-magento pushed a commit that referenced this issue Sep 30, 2016
Fixed issues:
- MAGETWO-56866: [GITHUB] Custom option prices unexpectedly change after save #6116 #6342
- MAGETWO-58873: Cannot receive shipping quotes via the admin panel or front end
- MAGETWO-55216: Reference by name to non existing plugin lead to Di compilation failure
- MAGETWO-58958: Fatal error in console in flow for apply new Scheduled Staging Update using CRON
- MAGETWO-55924: [FT] Test fails because of unexpected alert window
- MAGETWO-58664: [GitHub] Free shipping rule with table shipping method breaks checkout #6346
- MAGETWO-58849: [GitHub] Error in product edit page after disable Review module #6704
@WaterSlide
Copy link

Confirmed still an issue in CE 2.1.3

@WaterSlide
Copy link

For USD price formatting in the administration back end, there is really no need for a comma in the price (which seems to improperly attribute a decimal to your value on product save). My temporary fix is to just stop reporting prices with the comma with:

\vendor\magento\module-catalog\Ui\DataProvider\Product\Form\Modifier\CustomOptions.php

protected function formatPrice($value)
    {
        if (!is_numeric($value)) {
            return null;
        }

        $store = $this->storeManager->getStore();
        $currency = $this->getLocaleCurrency()->getCurrency($store->getBaseCurrencyCode());
        $value = $currency->toCurrency($value, ['display' => \Magento\Framework\Currency::NO_SYMBOL]);
        // Remove comma from value:
        $value = str_replace(",","",$value);
        return $value;
    }

I've yet to learn how to override in a much more proper way and for this I apologize.

@AirmanAJK
Copy link
Author

Hi WaterSlide. To address the right way to fix this, normally you would want to create an "after" plugin in your own extension to just update the value after the function is called, but since this formatPrice() function is protected, you either need to apply the plugin to another function in the call stack, or extend the class and force you inherited version to be injected using the di.xml configuration. The latter is a bit more invasive as it replaces the entire class with yours, which is why a plugin is typically preferred for these kinds of small changes.

@mthsialkot
Copy link

I'm using current version 2.1.3 but has this problem wrong price for all those products which have customize options in all currencies other than base currency for example attached product has price 43,065 PKR but show in millions
screenhunter_85 jan 13 08 46_810

@senders
Copy link

senders commented Apr 3, 2017

This Bug is still open since month. And I can confirm that it still exists in 2.1.5.
When will you remedy that problem.

@senders
Copy link

senders commented Apr 3, 2017

This patch seems to work fine in magento 2.1.5:

496c24d

But why it isn't still integrated in one of the latest magento versions 2.1.3, 2.1.4 or 2.1.5. ???

@titechnologies
Copy link

Still its not working in 2.1.5.
Totally wrong prices when currency switching.
its fine in default currency.

@veloraven
Copy link
Contributor

Internal ticket for ver. 2.1 - MAGETWO-58571.
The issue has been already fixed and will be available in one of the nearest releases.

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Catalog Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

@AirmanAJK, thank you for your report.
The issue is already fixed in 2.2.0

@magento-engcom-team magento-engcom-team added 2.1.x Fixed in 2.2.x The issue has been fixed in 2.2 release line Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release labels Sep 20, 2017
@nawabamit
Copy link

i have same issue like that. when i have update product price rs50000 and save, after some time it show the value like rs50 in backend and frontend in magento 2 version 2.1.8. kindly resolved it asap.price change automatically.fully frustrated guys help me.

@gopal2k6
Copy link

gopal2k6 commented Jan 16, 2019

I have also same issue . When i have update product price 1.000,00 which is converted into 1 Kindly update
mY version is 2.1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests