Find the price of a product
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!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Find the price of a product
Hello there,
I need to get one specific price of a product from the product id, i did this:
I want to search the price by the currencyid but i don't understand how to continue the query.
I really appreciate any help you can provide.
I need to get one specific price of a product from the product id, i did this:
Code: Select all
$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
$item = $manager->getItem( $id, array( 'price' ) );
I really appreciate any help you can provide.
Re: Find the price of a product
Your product item will now contain prices and you can retrieve them via
The second parameter is the price type and the third (optional) parameter is the product list type for the prices.
In the frontend, the $prices array will only contain the price items with the same currency as the used locale (site/lang/currency combination). If you've written an importer for example, $prices will contain all price items regardless of the currency by default. Then you have to iterate of the items and call $item->getCurrencyId() to check if it's the currency you need.
Code: Select all
$prices = $item->getRefitems( 'price', 'default', 'default' );
In the frontend, the $prices array will only contain the price items with the same currency as the used locale (site/lang/currency combination). If you've written an importer for example, $prices will contain all price items regardless of the currency by default. Then you have to iterate of the items and call $item->getCurrencyId() to check if it's the currency you need.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star