Skip to content

Commit f286489

Browse files
author
Roger
committed
Issue 35981: Cart Rule with product qty requirement does work
1 parent 0f6dde0 commit f286489

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/code/Magento/SalesRule/Model/Rule/Condition/Product.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\SalesRule\Model\Rule\Condition;
89

@@ -22,7 +23,7 @@ class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct
2223
protected function _addSpecialAttributes(array &$attributes)
2324
{
2425
parent::_addSpecialAttributes($attributes);
25-
$attributes['quote_item_qty'] = __('Quantity in cart');
26+
$attributes['parent::quote_item_qty'] = __('Quantity in cart');
2627
$attributes['quote_item_price'] = __('Price in cart');
2728
$attributes['quote_item_row_total'] = __('Row total in cart');
2829

app/code/Magento/SalesRule/Model/Rule/Condition/Product/Combine.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\SalesRule\Model\Rule\Condition\Product;
79

810
use Magento\Catalog\Model\ResourceModel\Product\Collection;
@@ -45,7 +47,7 @@ public function getNewChildSelectOptions()
4547
$pAttributes = [];
4648
$iAttributes = [];
4749
foreach ($productAttributes as $code => $label) {
48-
if (strpos($code, 'quote_item_') === 0) {
50+
if (strpos($code, 'quote_item_') === 0 || strpos($code, 'parent::quote_item_') === 0) {
4951
$iAttributes[] = [
5052
'value' => \Magento\SalesRule\Model\Rule\Condition\Product::class . '|' . $code,
5153
'label' => $label,

0 commit comments

Comments
 (0)