Filter by customer group in admin panel
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Filter by customer group in admin panel
Hi.
In this article I found a solution for this case. https://aimeos.org/help/viewtopic.php?f ... 949#p24949
Advice for it is use 'customer:has("group","default",<id>)'
But I don't know how to use it. Below is my code for search. Is available any code example or something else ?
$total = 0;
$params = $this->storeFilter( $view->param(), 'customer' );
$manager = \Aimeos\MShop::create( $this->context(), 'customer' );
$search = $this->initCriteria( $manager->filter(), $params );
$view->items = $manager->search( $search, $this->getDomains(), $total );
$view->filterAttributes = $manager->getSearchAttributes( true );
$view->filterOperators = $search->getOperators();
$view->itemBody = parent::search();
$view->total = $total;
In this article I found a solution for this case. https://aimeos.org/help/viewtopic.php?f ... 949#p24949
Advice for it is use 'customer:has("group","default",<id>)'
But I don't know how to use it. Below is my code for search. Is available any code example or something else ?
$total = 0;
$params = $this->storeFilter( $view->param(), 'customer' );
$manager = \Aimeos\MShop::create( $this->context(), 'customer' );
$search = $this->initCriteria( $manager->filter(), $params );
$view->items = $manager->search( $search, $this->getDomains(), $total );
$view->filterAttributes = $manager->getSearchAttributes( true );
$view->filterOperators = $search->getOperators();
$view->itemBody = parent::search();
$view->total = $total;
Re: Filter by customer group in admin panel
I tried by this way but it didn't help
$manager = \Aimeos\MShop::create( $this->context(), 'customer' );
$search = $this->initCriteria( $manager->filter(), $params );
$func = $search->make( 'customer:has', ['group', 'default', 1] );
$expr = array(
$search->compare( '!=', $func, null ),
);
$search->setConditions( $search->and( $expr ) );
$view->items = $manager->search( $search, $this->getDomains(), $total );
$manager = \Aimeos\MShop::create( $this->context(), 'customer' );
$search = $this->initCriteria( $manager->filter(), $params );
$func = $search->make( 'customer:has', ['group', 'default', 1] );
$expr = array(
$search->compare( '!=', $func, null ),
);
$search->setConditions( $search->and( $expr ) );
$view->items = $manager->search( $search, $this->getDomains(), $total );
Re: Filter by customer group in admin panel
This should work and filter for customers having group "1" associated:
Code: Select all
$manager = \Aimeos\MShop::create( $this->context(), 'customer' );
$search = $this->initCriteria( $manager->filter(), $params );
$search->add( $search->make( 'customer:has', ['group', 'default', '1'] ), '!=', null );
$view->items = $manager->search( $search, $this->getDomains(), $total );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Filter by customer group in admin panel
Your given solution always gives an empty result. But I can't know why. Maybe reason is a version ? Project Aimeos version is 2023.07
Re: Filter by customer group in admin panel
In 2023.10, the domain is "customer/group" instead of "group":
Code: Select all
$manager = \Aimeos\MShop::create( $this->context(), 'customer' );
$search = $this->initCriteria( $manager->filter(), $params );
$search->add( $search->make( 'customer:has', ['customer/group', 'default', '1'] ), '!=', null );
$view->items = $manager->search( $search, $this->getDomains(), $total );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Filter by customer group in admin panel
Great. Thanks.