diff --git a/vendor/magento/module-advanced-sales-rule/Model/ResourceModel/Rule/Condition/Filter.php b/vendor/magento/module-advanced-sales-rule/Model/ResourceModel/Rule/Condition/Filter.php index 3d98979b41f9..609b130cb525 100644 --- a/vendor/magento/module-advanced-sales-rule/Model/ResourceModel/Rule/Condition/Filter.php +++ b/vendor/magento/module-advanced-sales-rule/Model/ResourceModel/Rule/Condition/Filter.php @@ -5,9 +5,9 @@ */ namespace Magento\AdvancedSalesRule\Model\ResourceModel\Rule\Condition; -use Magento\AdvancedRule\Model\Condition\FilterInterface; use Magento\AdvancedRule\Model\Condition\Filter as FilterModel; -use Magento\Quote\Model\Quote\Address; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\DB\Select; class Filter extends \Magento\Rule\Model\ResourceModel\AbstractResource { @@ -23,7 +23,7 @@ protected function _construct() /** * @return array - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ public function getFilterTextGenerators() { @@ -51,6 +51,20 @@ public function getFilterTextGenerators() * @return array */ public function filterRules(array $filterText) + { + $connection = $this->getConnection(); + $results = $connection->fetchAssoc($this->getFilterRulesSelect($filterText)); + return array_keys($results); + } + + /** + * Returns a select for filter rules + * + * @param array $filterText + * @return Select + * @throws LocalizedException + */ + private function getFilterRulesSelect(array $filterText): Select { $connection = $this->getConnection(); $select = $connection->select()->from( @@ -66,8 +80,7 @@ public function filterRules(array $filterText) )->having( 'sum(weight) > 0.999' ); - $results = $connection->fetchAssoc($select); - return array_keys($results); + return $select; } /** diff --git a/vendor/magento/module-advanced-sales-rule/etc/db_schema.xml b/vendor/magento/module-advanced-sales-rule/etc/db_schema.xml index cabb9d9bc3a8..d5d06f92b49f 100644 --- a/vendor/magento/module-advanced-sales-rule/etc/db_schema.xml +++ b/vendor/magento/module-advanced-sales-rule/etc/db_schema.xml @@ -34,10 +34,11 @@ - + + diff --git a/vendor/magento/module-advanced-sales-rule/etc/db_schema_whitelist.json b/vendor/magento/module-advanced-sales-rule/etc/db_schema_whitelist.json index f6b7a7cca568..378ef5e7ad4d 100644 --- a/vendor/magento/module-advanced-sales-rule/etc/db_schema_whitelist.json +++ b/vendor/magento/module-advanced-sales-rule/etc/db_schema_whitelist.json @@ -12,7 +12,8 @@ "index": { "IDX_0270DA9E161D3DE2428F005FE39B89C8": true, "MAGENTO_SALESRULE_FILTER_RULE_ID": true, - "MAGENTO_SALESRULE_FILTER_FILTER_TEXT_RULE_ID_GROUP_ID": true + "MAGENTO_SALESRULE_FILTER_FILTER_TEXT_RULE_ID_GROUP_ID": true, + "MAGENTO_SALESRULE_FILTER_FILTER_TEXT_RULE_ID_GROUP_ID_WEIGHT": true }, "constraint": { "PRIMARY": true,