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

Fixed Custom option price calculation is wrong with multi currency when option price type is percentage #19608

Merged
merged 4 commits into from Feb 15, 2019

Conversation

ghost
Copy link

@ghost ghost commented Dec 7, 2018

Description (*)

We have set multi currency custom option with percentage price type now it is working with multi currency switcher.

Fixed Issues (if relevant)

  1. Custom option price calculation is wrong with multi currency when option price type is percentage.  #19561:Custom option price calculation is wrong with multi currency when option price type is percentage

Manual testing scenarios (*)

  1. Set Currency Rates in Magento from Stores > Currency Rates ( Ist -> 70.09, Usd -> 1)
  2. Goto Catalog > Product and edit any Simple product.
  3. Set custom option typed ‘dropdown’ and add options with Price type ‘percentage’.
  4. Go to Front end product details page in which you have created custom options.
  5. Change currency from Currency drop down. and now you will get correct price of the custom option.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @emiprotech. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@sivaschenko
Copy link
Member

Hi @emiprotech , thanks for the contribution! Have you tested the fixed option price with multicurrency after the fix? I wonder if we need to add currency conversion here:

return $this->_getData(self::KEY_PRICE);

@ghost
Copy link
Author

ghost commented Dec 7, 2018

@sivaschenko,
yes I checked after pull , it is not converted , now I am working on this issue. I will update new code. just give me few time.

@nimitaemipro nimitaemipro assigned ghost Dec 7, 2018
@sivaschenko
Copy link
Member

@emiprotech would you like to continue the progress on this pull request?

@ghost
Copy link
Author

ghost commented Feb 1, 2019

@sivaschenko Yes, Please continue the progress on this pull request.

@sidolov
Copy link
Contributor

sidolov commented Feb 5, 2019

Hi @emiprotech , I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@sidolov sidolov closed this Feb 5, 2019
@ghost
Copy link

ghost commented Feb 5, 2019

Hi @emiprotech, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost
Copy link
Author

ghost commented Feb 6, 2019

Hi,
I have updated code.
4d84a7a
Can you please look over it. ?

@ghost ghost reopened this Feb 6, 2019
Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

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

Hi @emiprotech thanks for the updates, please take a look at my code review notes

/**
* Option type percent
*/
protected static $typePercent = 'percent';
Copy link
Member

Choose a reason for hiding this comment

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

Pleare reuse \Magento\Catalog\Model\Product\Option\Value::TYPE_PERCENT instead of introducing this property

@@ -160,6 +165,7 @@ public function hasOptions()
*/
protected function _getPriceConfiguration($option)
{
$option->getPriceType() == self::$typePercent ? $optionPrice = $option->getPrice(true) :
Copy link
Member

Choose a reason for hiding this comment

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

I propose to simplify the code here to be easier to read, like:

       $optionPrice = $option->getPrice(true);
       If ($option->getPriceType() != Value::TYPE_PERCENT) {
           $optionPrice = $this->pricingHelper->currency($optionPrice, false, false);
       }

@ghost
Copy link
Author

ghost commented Feb 9, 2019

Hi @sivaschenko
Thanks for the suggestions, we have updated code as per your suggestion.
8bdedc5
Can you please review?

@magento-engcom-team
Copy link
Contributor

Hi @sivaschenko, thank you for the review.
ENGCOM-4217 has been created to process this Pull Request

@ghost
Copy link

ghost commented Feb 15, 2019

Hi @emiprotech, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants