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)
#6451 by kisese
15 Jul 2018, 13:45
A little help whenever i run the filter

I get all results instead of the filtered result. Also the example in the documentation


for getting products of type "select" does not return correct data.

Kindly assist :)

Aimeos version: 2017.10
PHP version: 7.1
Package: Laravel
Environment: Windows
#6467 by aimeos
17 Jul 2018, 22:30
kisese wrote:I get all results instead of the filtered result:

If you put that into the address line of you browser, the "=~" will be interpreted as "filter[", "=" and "~][product..." which isn't passed to the server correctly. The second problem is that "product.type" is a added to the result for simplification but only "product.type.code" remains a valid search key.

kisese wrote:Getting products of type "select" does not return correct data:

This filter does return all products whose type is lexicographically beyond "select". In the latest Aimeos version it will return products of type "voucher", in your version it will return nothing.

The correct URL for pasting into the browser would be:
Code: Select allhttp://localhost:8000/jsonapi/product?filter%5B%3D%3D%5D%5Bproduct.type.code%5D=select

like stated in the docs. If you pass the "{"filter": {"==": {"product.type.code":"select"}}}" JS object to e.g. to the jQuery $.ajax() method, it will get encoded automatically.