Skip to content

Fix the special price expression. #16510

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

Merged

Conversation

DmitriiChukhnov1
Copy link
Contributor

Description

The priority of "OR" is lower then "AND". That's why we have to add brackets around OR-expresstion.

Fixed Issues (if relevant)

Without this fix, catalog_product_price generate incorrect price data.

Without this fix, catalog_product_price generate incorrect price data.
The priority of "OR" is lower then "AND". That's why we have to add brackets around OR-expresstion.
Without this fix, catalog_product_price generate incorrect price data.
The priority of "OR" is lower then "AND". That's why we have to add brackets around OR-expresstion.
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jul 3, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @DmitryChukhnov. 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 {$VERSION} instance - deploy vanilla Magento instance

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

@VladimirZaets
Copy link
Contributor

Hi, @DmitryChukhnov, thank you for collaboration. Can you please provide more information or use case that related to this issue. I understand that current condition is wrong, but maybe the second condition is redundant

@DmitriiChukhnov1
Copy link
Contributor Author

Hi, @VladimirZaets . In my case I have not null specialFrom and null specialPrice (you can get this conditions if you save special price and then remove special price).
In result we have:

{$specialPrice} IS NOT NULL AND {$specialFromExpr} AND {$specialToExpr}

=> (substitution)

{$specialPrice} IS NOT NULL AND {$specialFrom} IS NULL OR {$specialFromDate} <= {$currentDate} AND {$specialTo} IS NULL OR {$specialToDate} >= {$currentDate}

=> (with values)

null IS NOT NULL AND "2018-07-01" IS NULL OR "2018-07-01" <= "2018-07-04" AND null IS NULL OR null >= "2018-07-04"

=> (comparison)

FALSE AND FALSE OR TRUE AND TRUE OR FALSE

=> (AND)

FALSE OR TRUE OR FALSE

=> (OR)

TRUE

But should be FALSE.

I hope this helps.

@magento-engcom-team
Copy link
Contributor

@DmitryChukhnov thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-engcom-team
Copy link
Contributor

Hi @DmitryChukhnov. Thank you for your contribution.
We will aim to release these changes as part of 2.2.7.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

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