Retrieve attributes from products

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!
igorpdasilva
Posts: 1
Joined: 31 Jul 2017, 13:57

Retrieve attributes from products

Post by igorpdasilva » 31 Jul 2017, 14:08

Hi, i need to retrieve some attributes weight, height width and length from products(sorry about my bad english rsrs). this informations is for the delivery service.
i have searched about this but not find what i want. i hope someone can help me. im grateful

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

Re: Retrieve attributes from products

Post by aimeos » 01 Aug 2017, 09:59

In the delivery services, you have the basket available including the products to be bought. They contain the product ID (article or selection ID) and the product code (always the article code). Weight/height/length/width are product properties you can retrieve with

Code: Select all

$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
$search = $manager->createSearch(true);
$search->setConditions( $search->compare( '==', 'product.id', <list of product ids> ) );
$search->setSlice( 0, 0x7fffffff );

foreach( $manager->searchItems( $search, ['product/property'] ) as $productItem ) {
    $propItems = $productItem->getPropertyItems();
}
You can also use this condition if you always need the articles:

Code: Select all

$search->setConditions( $search->compare( '==', 'product.code', <list of product codes> ) );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply