0

I'm a bit new here in the forum som feel free to slap me on the fingers if I'm dumb.

I want to change the logic in the sales rules engine so it doesn't check the salesrules_customer_id table and instead just skips that filtering.

The reason for this is that the site I'm building is going to use A lot of the same cart price rules. And the less the algorithm checks for the faster the site.

I've been debugging around in: Magento\SalesRule\Model\ResourceModel

But still I'm not able to find what I'm searching for.

Anyone got any clue how to solves this?

0

I've narrowed it down to this code:

public function addCustomerGroupFilter($customerGroupId)
    {
        $entityInfo = $this->_getAssociatedEntityInfo('customer_group');
        if (!$this->getFlag('is_customer_group_joined')) {
            $this->setFlag('is_customer_group_joined', true);
            $this->getSelect()->join(
                ['customer_group' => $this->getTable($entityInfo['associations_table'])],
                $this->getConnection()
                    ->quoteInto('customer_group.' . $entityInfo['entity_id_field'] . ' = ?', $customerGroupId)
                . ' AND main_table.' . $entityInfo['rule_id_field'] . ' = customer_group.'
                . $entityInfo['rule_id_field'],
                []
            );
        }
        $this->setFlag('is_customer_group_joined', true);
        $this->getSelect()->join(
            ['customer_group' => $this->getTable($entityInfo['associations_table'])],
            $this->getConnection()
                ->quoteInto('customer_group.' . $entityInfo['entity_id_field'] . ' = ?', $customerGroupId)
            . ' AND main_table.' . $entityInfo['rule_id_field'] . ' = customer_group.'
            . $entityInfo['rule_id_field'],
            []
        );
        return $this;
    }

Still not sure how I'm going to modify it though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.