Joins Queries
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!
-
- Posts: 40
- Joined: 12 Jul 2018, 19:57
Joins Queries
Hi there;
Is there a way to get users with an associated customer group? or is there a way to do joins queries?
I need to do something like this but with managers
Thanks
Is there a way to get users with an associated customer group? or is there a way to do joins queries?
I need to do something like this but with managers
Code: Select all
select * from users as u inner join users_list ul on u.id = ul.parentid join mshop_customer_group mcg on cast(ul.refid as integer) = mcg.id
--
Jorge A Ramirez
System Engineer
PHP Developer
Jorge A Ramirez
System Engineer
PHP Developer
Re: Joins Queries
Easy going: Use "customer/group" for the list of domain names to fetch in getItem(), findItem() or searchItems(), e.g.:
Code: Select all
$customerItem = $manager->getItem( 123, ["customer/group"] );
$groupItems = $customerItem->getRefItems( "customer/group" );
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
-
- Posts: 40
- Joined: 12 Jul 2018, 19:57
Re: Joins Queries
Yes, I've worked in that way, and it returns all users even if they don't have an assigned customer group. I want to get only users with an assigned customer group.
--
Jorge A Ramirez
System Engineer
PHP Developer
Jorge A Ramirez
System Engineer
PHP Developer
Re: Joins Queries
When you've installed 2019.04, you can use the "customer:has" search function:
Code: Select all
$search = $manager->createSearch();
$func = $search->createFunction( 'customer:has', ['customer/group'] );
$search->setConditions( $search->compare( '!=', $func, null ) );
$items = $manager->searchItems( $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
-
- Posts: 40
- Joined: 12 Jul 2018, 19:57
Re: Joins Queries
Thanks, for previous version is not there a way to do that ?
--
Jorge A Ramirez
System Engineer
PHP Developer
Jorge A Ramirez
System Engineer
PHP Developer
Re: Joins Queries
Not really the same, you can only search for customers that contain a specific user group by its ID with "customer:has". The only alternative is a low level query and feeding the result into the customer manager but that requires in total two queries instead of one.
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