product filter jsonapi

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!
agatqapp
Posts: 13
Joined: 15 Jan 2022, 07:02

product filter jsonapi

Post by agatqapp » 14 Jul 2022, 11:26

Hello sir

I used laravel aimeos
aimeos/aimeos-core 2021.07.*
php ~7.1||~8.0

In my product list
some product has Texts => name/description in en/ar/fr three languages
some has 2 en/ar, and some has only one language en

when i go in fronted with en in url like domain.com/en/usd/shop/....
then its display all products with en name on list page (because all product has en translate text name )

when i go with ar like domain.com/ar/usd/shop/....
its display all product with ar name which product has ar translate text
otherwise show en name text, but display all products either has ar translate product name or not

here i want, if we go with ar in url
than show only products which has ar translate name Texts, otherwise skip on list page

and if we go with fr than show products which has fr translate text name not all products

like we can add include=text with language filter also in this url
http://localhost:8000/jsonapi/product?include=text

thanks

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

Re: product filter jsonapi

Post by aimeos » 17 Jul 2022, 06:38

Sorry, there's no way to filter by language ID for product name in the JSON REST API.

If you add the available languages as product properties, you can filter by the property.

Required properties:
- type: langid, langid=en, value=1
- type: langid, langid=ar, value=1

JSON API filter:

Code: Select all

/product?filter[!=][product:prop("langid","ar",1)]=
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply