Jump to content

Filter by discount in sort by


laqmarc

Recommended Posts

Hello, I would like to know if there is any way to filter by discount in the facets module.

I have tried adding a case in private function addSearchFilters($selectedFilters) but it doesn't quite work for me.

 case 'offer':
        if ($orderDirection === 'desc') {
            $this->query->addOrderBy('(price - reduced_price) / price', 'DESC');
        } else {
            $this->query->addOrderBy('(price - reduced_price) / price', 'ASC');
        }
        break;

But it doesn't work for me, I've been looking at the documentation but I'm quite lost.

Any ideas?

Greetings

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...