Adding a column from products table to searchable index so that all products with specific column value can be searched

Help for integrating the Laravel package
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!
User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Adding a column from products table to searchable index so that all products with specific column value can be searc

Post by aimeos » 14 May 2022, 07:13

If you create a decorator for the product manager, you can also search for new properties:
https://aimeos.org/docs/latest/models/e ... /#easy-way

Code: Select all

$manager = \Aimeos\MShop::create( $context, 'product' );
$filter = $manager->filter()->add( 'tags', '==', 'Best Seller' );
$items = $manager->search( $filter );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Adding a column from products table to searchable index so that all products with specific column value can be searc

Post by aimeos » 17 May 2022, 14:30

In that case, use the frontend product controller from your screenshot and add this for filtering by tags:

Code: Select all

->compare( '==', 'tags', 'Best seller' )
See: https://github.com/aimeos/ai-controller ... ce.php#L62
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Adding a column from products table to searchable index so that all products with specific column value can be searc

Post by aimeos » 19 May 2022, 06:38

Place your condition between the create() and search() methods in an if() condition:

Code: Select all

$cntl = \Aimeos\Controller\Frontend::create( $context, 'product' );

if( $theme = $view->param( 'f_theme' ) ) {
	$cnt->compare( '==', 'themes', $theme );
}

$products = $cntl->...()->search();
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply