empty result when get category product
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
empty result when get category product
I'm trying to get products list for category id = 1.
This code should get it
but it returns empty result. Why?
This code should get it
Code: Select all
$tree = \Aimeos\Controller\Frontend::create( $context, 'catalog' )->uses( ['catalog', 'media', 'supplier', 'text', 'product'] )
->getTree( \Aimeos\Controller\Frontend\Catalog\Iface::LIST )->getPath( 1 );
$products = $tree->getRefItems( 'product', null, 'promotion' );
- Attachments
-
- Screenshot 2022-04-29 063404.png (3.22 KiB) Viewed 572 times
Re: empty result when get category product
This will return the catalog root node but no products.
Use this to get the promotional products for category with ID 1:
Have a look at the interface for the available methods:
https://github.com/aimeos/ai-controller ... /Iface.php
Use this to get the promotional products for category with ID 1:
Code: Select all
$products = \Aimeos\Controller\Frontend::create( $context, 'product' )
->uses( ['catalog', 'media', 'supplier', 'text', 'product'] ) // use 'product' only if you need the variants/referred products too
->category( 1, 'promotion' )
->search();
https://github.com/aimeos/ai-controller ... /Iface.php
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