Get sites details from product id

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)
Spam and unrelated posts will be removed immediately!
traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Get sites details from product id

Post by traiyani75 » 23 Apr 2020, 19:36

Hello, we are using laravel JSON API on the application side for android and ios.
Most of the things are done, but now we need to add the distributor name of the product.

So, we have added multiple sites into main parent, and every site we have added 10-10 products. Now, We need to show the product with the site's name. Like product-A is selling by Xyz.

How do we achieve this?
Thanks

traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Re: Get sites details from product id

Post by traiyani75 » 28 Apr 2020, 14:06

hello, Is there any solution for that? We need to show products by vendor name as well?
For that, we need to show vendor name into product details first then from there the user can visit the complete vendor store.

Will it be possible?

Thanks

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

Re: Get sites details from product id

Post by aimeos » 29 Apr 2020, 09:28

There's no way to retrieve all available sites using the JSON REST API for security reasons. If you need the site name, you have to extend the product endpoint class (https://github.com/aimeos/ai-client-jso ... #L281-L319), fetch the locale site items for the products returned (using $product->getSiteId() and the searchItems() method of the locale site manager) and add that information in the product template (https://github.com/aimeos/ai-client-jso ... #L106-L133)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: Get sites details from product id

Post by aimeos » 29 Sep 2023, 09:13

Site information is now available per product if you add "include=locale.site"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply