how to get list of products of a store

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
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

how to get list of products of a store

Post by ahmed31916 » 25 Apr 2022, 12:11

Hello,

how to get a list of products of a specific store?

another question, why when I use any method of "MShop\Product\Manager\Standard.php", I got "Called unknown macro".

For example, when I use this method "getSiteItems" like this:

Code: Select all

$manager = \Aimeos\MShop::create( app( 'aimeos.context' )->get(), 'index' );
$manager->search( $manager->filter() )->getSiteItems(1);
I got this error:

Code: Select all

Called unknown macro "getSiteItems" on class "Aimeos\MShop\Product\Item\Standard"

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

Re: how to get list of products of a store

Post by aimeos » 26 Apr 2022, 08:00

There's no method named getSiteItems() implemented in the product items and therefore, the error is reported.
The site the products are returned for is automatically determined by the site ID included in the locale object of the context. The locale object is returned by the bootstrap() method of the locale manager depending on the site code passed ("default") if nothing else is given:
https://github.com/aimeos/aimeos-core/b ... /Iface.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: how to get list of products of a store

Post by ahmed31916 » 27 Apr 2022, 13:32

Ok, this return the locale item, but not site products.

Code: Select all

$manager->bootstrap('default', 'en', 'usd', true, 1);
How to add site products to the query?
Attachments
Screenshot 2022-04-27 163206.png
Screenshot 2022-04-27 163206.png (36.85 KiB) Viewed 1137 times

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: how to get list of products of a store

Post by ahmed31916 » 27 Apr 2022, 20:49

@aimeos
help me, please :roll:

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

Re: how to get list of products of a store

Post by aimeos » 28 Apr 2022, 05:33

This will return the products from the current site ("default"):

Code: Select all

$manager = \Aimeos\MShop::create( app( 'aimeos.context' )->get(), 'index' );
$productItems = $manager->search( $manager->filter() );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: how to get list of products of a store

Post by ahmed31916 » 28 Apr 2022, 14:59

thank you very very much, clarified. :idea:

Post Reply