How to filter by property?

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Posts: 1
Joined: 08 Jul 2021, 16:19

How to filter by property?

Post by materialshop » 08 Jul 2021, 16:30


I'm trying to create a shop where the products are different materials that mainly differ in dimensions (thickness, diameter, length, width, etc.). I would like to be able to filter by these dimensions (show only products from X category that have a thickness of Y, and/or a width greater than Z-- for example).

I'm having trouble understanding how best to go about this. I'm pretty sure that I need to have my product have a and corresponding to each different dimension, because otherwise I would have hundreds of different attributes of Width, or Diameter.

In the filters though, there are no parameters for product properties (as there are for attributes and suppliers). What is the best approach to accomplishing my goal?

User avatar
Posts: 5265
Joined: 01 Jan 1970, 00:00

Re: How to filter by property?

Post by aimeos » 11 Jul 2021, 16:30

(Product) Properties are text strings and you won't be able to filter by them because "500" isn't greater than "50.0" when comparing texts. If you only sell products that all have these dimensions, our recommendation would be to add these dimensions as additional columns to the mshop_product table with a matching column type (float or decimal). You can use a decorator for that:

Then, you have to adapt the HTML frontend to add your filters and extend the catalog/lists component (create a new class and extend from the original one) to pass the additional filters if available: ... #L710-L721

Use the compare() method of the product frontend controller to add the conditions: ... hp#L53-L62

Code: Select all

$cntl->compare( '>', 'diameter', '5.0' );
Don't forget to sanitize the values first ("," vs. "." for decimal separator) or better use number fields.
Professional support and custom implementation are available at
If you like Aimeos, Image give us a star

Posts: 1
Joined: 22 Jul 2021, 05:04

Re: How to filter by property?

Post by isiahcolson » 22 Jul 2021, 07:14

Thank you for the clarification.
That helps a lot!

Post Reply