Closed leeroybrun closed 3 years ago
Hi @leeroybrun. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
For anyone interested, here is a patch you can apply while waiting for the pull request to be merged :
diff --git a/Model/Rule/Condition/Product/Combine.php b/Model/Rule/Condition/Product/Combine.php
index 35e7e6214461..eeefbb5c29de 100644
--- a/Model/Rule/Condition/Product/Combine.php
+++ b/Model/Rule/Condition/Product/Combine.php
@@ -143,7 +143,7 @@ private function validateEntity($cond, \Magento\Framework\Model\AbstractModel $e
* @param \Magento\Framework\Model\AbstractModel $entity
* @return \Magento\Framework\Model\AbstractModel[]
*/
- private function retrieveValidateEntities($attributeScope, \Magento\Framework\Model\AbstractModel $entity)
+ protected function retrieveValidateEntities($attributeScope, \Magento\Framework\Model\AbstractModel $entity)
{
if ($attributeScope === 'parent') {
$parentItem = $entity->getParentItem();
diff --git a/Model/Rule/Condition/Product/Found.php b/Model/Rule/Condition/Product/Found.php
index 9cb852292b1f..fabe8f18df49 100644
--- a/Model/Rule/Condition/Product/Found.php
+++ b/Model/Rule/Condition/Product/Found.php
@@ -65,10 +65,12 @@ public function validate(\Magento\Framework\Model\AbstractModel $model)
foreach ($model->getAllItems() as $item) {
$found = $all;
foreach ($this->getConditions() as $cond) {
- $validated = $cond->validate($item);
- if ($all && !$validated || !$all && $validated) {
- $found = $validated;
- break;
+ foreach ($this->retrieveValidateEntities($cond->getAttributeScope(), $item) as $validateEntity) {
+ $validated = $cond->validate($validateEntity);
+ if ($all && !$validated || !$all && $validated) {
+ $found = $validated;
+ break;
+ }
}
}
if ($found && $true || !$true && $found) {
Here is how to apply a patch : https://devdocs.magento.com/guides/v2.4/comp-mgr/patching/composer.html
Basically you create a file patches/composer/salesrule-found-cond-attributescope.diff
with the patch above.
Then in composer.json
you add this to the extra
values :
"composer-exit-on-patch-failure": true,
"patches": {
"magento/module-sales-rule": {
"Github Issue 33738: Fix wrong Found SalesRule condition validation ignoring attribute scope": "patches/composer/salesrule-found-cond-attributescope.diff"
}
}
Then run :
composer install
composer update --lock
Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @leeroybrun,
Thank you for reporting the issue.
I tried to reproduce this on 2.4-develop instance without Amasty Shipping Restrictions but the SalesRules are working as expected.
Here is what I tried on Magento 2.4-develop version:
So we need some additional information in order to reproduce this:
Dear @leeroybrun,
We have noticed that this issue has not been updated for a period of more than 14 Days. Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.
Regards
The bug still persists.
The solution from @leeroybrun seems to be working.
Preconditions (*)
Steps to reproduce (*)
false
true
false
and in that case it should disable a shipping method.Expected result (*)
Actual result (*)
false
), even though we had used the "Children Only" attributeThis is a big problem because all the sales rules using a "found" condition with an attribute scope ("Children Only"/"Parent Only") will not work as expected.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.