How to sort a Laravel Aimeos query builder result by the sequence I want?

Viewed 12

I want to sort my products in Laravel 8 by using the Iface method of Aimeos in Laravel website. The sql query I tested in my database is like this:

select * from mshop_product
order by config like '%core-product%' desc,
config like '%pre-order%' desc,
config like '%coming-soon%' desc,
config like '%original_price%' desc

How can I do this?

$products = \Aimeos\Controller\Frontend::create( $context, 'product' )
            ->sort( '-product.config' )
            ->.....

This is the code that I write to make it those products with config written arranged to front, while those not written (which is NULL) arranged after those.

Thank you so much.

0 Answers
Related