sort products by id
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
sort products by id
Hello Aimeos,
Why the sort method doesn't work here?
Why the sort method doesn't work here?
Code: Select all
$manager = \Aimeos\Controller\Frontend::create( $context, 'product' )->uses( $domains );
$feature_cars = $manager->search()->slice(0,5)->sort('-', 'product.id');
Re: sort products by id
The sort() method accepts only a single parameter, not two:
See here: https://github.com/aimeos/ai-controller ... #L187-L194
Code: Select all
$cntl = \Aimeos\Controller\Frontend::create( $context, 'product' )->uses( $domains );
$cntl->slice(0,5)->order('-product.id')->search();
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Re: sort products by id
I got this error:
https://flareapp.io/share/LPlLk8DP#F66
Code: Select all
Call to a member function getType() on null
Re: sort products by id
Please create a new topic for questions not related to the existing topic.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Re: sort products by id
But nevertheless, another problem in another file and not related to your initial question.
The problem is that you use:
This will error if there's not price available and to circumvent the error, you can use this instead:
The problem is that you use:
Code: Select all
$prices->first()->getType()
Code: Select all
$prices->getType()->first()
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star