Model/Rules.php
public function processOrCombination($collection, $conditions)
    {
        $fieldsConditions = [];
        $multiFieldsConditions = [];
        foreach ($conditions as $condition) {
            $attribute = $condition['attribute'];
            $cond = $condition['conditions'];
            $value = $condition['cvalue'];

            //ignore condition if value is null or empty
            if ($value == '' or $value == null) {
                continue;
            }

            if ($this->ruleType == self::REVIEW && isset($this->attributeMapForQuote[$attribute])) {
                $attribute = $this->attributeMapForOrder[$attribute];
            } elseif ($this->ruleType == self::ABANDONED && isset($this->attributeMapForOrder[$attribute])) {
                $attribute = $this->attributeMapForQuote[$attribute];
            } else {
                $this->productAttribute[] = $condition;
                continue;
            }

            if ($cond == 'null') {
                if ($value == '1') {
                    if (isset($fieldsConditions[$attribute])) {
                        $multiFieldsConditions[$attribute][]
                            = ['notnull' => true];
                        continue;
                    }
                    $fieldsConditions[$attribute] = ['notnull' => true];
                } elseif ($value == '0') {
                    if (isset($fieldsConditions[$attribute])) {
                        $multiFieldsConditions[$attribute][]
                            = [$cond => true];
                        continue;
                    }
                    $fieldsConditions[$attribute] = [$cond => true];
                }
            } else {
                if ($cond == 'like' or $cond == 'nlike') {
                    $value = '%' . $value . '%';
                }
                if (isset($fieldsConditions[$attribute])) {
                    $multiFieldsConditions[$attribute][]
                        = [$this->conditionMap[$cond] => $value];
                    continue;
                }
                $fieldsConditions[$attribute]
                    = [$this->conditionMap[$cond] => $value];
            }
        }
        //all rules condition will be with or combination
        if (!empty($fieldsConditions)) {
            $column = $cond = [];
            foreach ($fieldsConditions as $key => $fieldsCondition) {
                $column[] = (string)$key;
                $cond[] = $fieldsCondition;
                if (!empty($multiFieldsConditions[$key])) {
                    foreach ($multiFieldsConditions[$key] as $multiFieldsCondition) {
                        $column[] = (string)$key;
                        $cond[] = $multiFieldsCondition;
                    }
                }
            }
            $collection->addFieldToFilter(
                $column,
                $cond
            );
        }
        return $this->processProductAttributes($collection);
    }
public function processOrCombination($collection, $conditions)
    {
        $fieldsConditions = [];
        $multiFieldsConditions = [];
        foreach ($conditions as $condition) {
            $attribute = $condition['attribute'];
            $cond = $condition['conditions'];
            $value = $condition['cvalue'];

            //ignore condition if value is null or empty
            if ($value == '' or $value == null) {
                continue;
            }

            if ($this->ruleType == self::REVIEW && isset($this->attributeMapForQuote[$attribute])) {
                $attribute = $this->attributeMapForOrder[$attribute];
            } elseif ($this->ruleType == self::ABANDONED && isset($this->attributeMapForOrder[$attribute])) {
                $attribute = $this->attributeMapForQuote[$attribute];
            } else {
                $this->productAttribute[] = $condition;
                continue;
            }

            if ($cond == 'null') {
                if ($value == '1') {
                    if (isset($fieldsConditions[$attribute])) {
                        $multiFieldsConditions[$attribute][]
                            = ['notnull' => true];
                        continue;
                    }
                    $fieldsConditions[$attribute] = ['notnull' => true];
                } elseif ($value == '0') {
                    if (isset($fieldsConditions[$attribute])) {
                        $multiFieldsConditions[$attribute][]
                            = [$cond => true];
                        continue;
                    }
                    $fieldsConditions[$attribute] = [$cond => true];
                }
            } else {
                if ($cond == 'like' or $cond == 'nlike') {
                    $value = '%' . $value . '%';
                }
                if (isset($fieldsConditions[$attribute])) {
                    $multiFieldsConditions[$attribute][]
                        = [$this->conditionMap[$cond] => $value];
                    continue;
                }
                $fieldsConditions[$attribute]
                    = [$this->conditionMap[$cond] => $value];
            }
        }
        //all rules condition will be with or combination
        if (!empty($fieldsConditions)) {
            $column = $cond = [];
            foreach ($fieldsConditions as $key => $fieldsCondition) {
                $column[] = (string)$key;
                $cond[] = $fieldsCondition;
                if (!empty($multiFieldsConditions[$key])) {
                    foreach ($multiFieldsConditions[$key] as $multiFieldsCondition) {
                        $column[] = (string)$key;
                        $cond[] = $multiFieldsCondition;
                    }
                }
            }
            $collection->addFieldToFilter(
                $column,
                $cond
            );
        }
        return $this->processProductAttributes($collection);
    }
public function processOrCombination ( $ collection , $ conditions ) { $ fieldsConditions = [ ] ; $ multiFieldsConditions = [ ] ; foreach ( $ conditions as $ condition ) { $ attribute = $ condition [ 'attribute' ] ; $ cond = $ condition [ 'conditions' ] ; $ value = $ condition [ 'cvalue' ] ; //ignore condition if value is null or empty if ( $ value == '' or $ value == null ) { continue ; } if ( $ this -> ruleType == self :: REVIEW && isset ( $ this -> attributeMapForQuote [ $ attribute ] ) ) { $ attribute = $ this -> attributeMapForOrder [ $ attribute ] ; } elseif ( $ this -> ruleType == self :: ABANDONED && isset ( $ this -> attributeMapForOrder [ $ attribute ] ) ) { $ attribute = $ this -> attributeMapForQuote [ $ attribute ] ; } else { $ this -> productAttribute [ ] = $ condition ; continue ; } if ( $ cond == 'null' ) { if ( $ value == '1' ) { if ( isset ( $ fieldsConditions [ $ attribute ] ) ) { $ multiFieldsConditions [ $ attribute ] [ ] = [ 'notnull' => true ] ; continue ; } $ fieldsConditions [ $ attribute ] = [ 'notnull' => true ] ; } elseif ( $ value == '0' ) { if ( isset ( $ fieldsConditions [ $ attribute ] ) ) { $ multiFieldsConditions [ $ attribute ] [ ] = [ $ cond => true ] ; continue ; } $ fieldsConditions [ $ attribute ] = [ $ cond => true ] ; } } else { if ( $ cond == 'like' or $ cond == 'nlike' ) { $ value = '%' . $ value . '%' ; } if ( isset ( $ fieldsConditions [ $ attribute ] ) ) { $ multiFieldsConditions [ $ attribute ] [ ] = [ $ this -> conditionMap [ $ cond ] => $ value ] ; continue ; } $ fieldsConditions [ $ attribute ] = [ $ this -> conditionMap [ $ cond ] => $ value ] ; } } //all rules condition will be with or combination if ( ! empty ( $ fieldsConditions ) ) { $ column = $ cond = [ ] ; foreach ( $ fieldsConditions as $ key => $ fieldsCondition ) { $ column [ ] = ( string ) $ key ; $ cond [ ] = $ fieldsCondition ; if ( ! empty ( $ multiFieldsConditions [ $ key ] ) ) { foreach ( $ multiFieldsConditions [ $ key ] as $ multiFieldsCondition ) { $ column [ ] = ( string ) $ key ; $ cond [ ] = $ multiFieldsCondition ; } } } $ collection -> addFieldToFilter ( $ column , $ cond ) ; } return $ this -> processProductAttributes ( $ collection ) ; }
process Or combination on collection.

@param \Magento\Sales\Model\ResourceModel\Order\Collection|
\Magento\Quote\Model\ResourceModel\Quote\Collectio $collection
@param array $conditions
@param string $type

@return \Magento\Sales\Model\ResourceModel\Order\Collection|
\Magento\Quote\Model\ResourceModel\Quote\Collection $collection

@SuppressWarnings(PHPMD.NPathComplexity)
@SuppressWarnings(PHPMD.CyclomaticComplexity)
process Or combination on collection .