How to get product stock?

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!
UrielC
Posts: 2
Joined: 20 Oct 2020, 22:27

How to get product stock?

Post by UrielC » 20 Oct 2020, 22:32

Hello, I need to get the stock value of a product and I'm using the getStockItems function, but I have no results. My code looks like this:

Code: Select all

$newfunction = function( \Aimeos\MShop\Product\Item\Iface $item ) use ( $fields, $target, $cntl, $action, $config ){
var_dump($item->getStockItems( ));
die();
}
Other functions like getCode () are normal, where am I missing?

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

Re: How to get product stock?

Post by aimeos » 21 Oct 2020, 10:10

Stock items are only part of the product item if you pass "[..., 'stock']" as second parameter to the search/searchItems method. The list of domains for the second parameter can be configured if you aren't using custom code for that.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

UrielC
Posts: 2
Joined: 20 Oct 2020, 22:27

Re: How to get product stock?

Post by UrielC » 22 Oct 2020, 20:15

Thanks!

Post Reply