How to get product price according to different user roles ?
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 28
- Joined: 21 May 2019, 09:52
How to get product price according to different user roles ?
I have created three types of user roles and three different types of product prices on the basis the user roles.
But When I add product in the basket. I am getting default price. In the view file.
ext/ai-client-html/client/html/src/Client/Html/Basket/Standard/Standard.php
$controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' );
$view->standardBasket = $controller->get();
//Here I am getting default price.
However It gives correct values in $prices When I changed
$prices = $productItem->getRefItems( 'price', 'default', 'default' ); to $prices = $productItem->getRefItems( 'price', 'gold', 'default' ); (Where 'gold' is price type) in Controller files /ext/ai-controller-frontend/controller/frontend/src/Controller/Frontend/Basket/Standard.php
public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
But $this->summaryBasket price values are not getting updated as per price type.
Please help me to update price in summaryBasket in the view file.
Thanks
Harpal Singh
But When I add product in the basket. I am getting default price. In the view file.
ext/ai-client-html/client/html/src/Client/Html/Basket/Standard/Standard.php
$controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' );
$view->standardBasket = $controller->get();
//Here I am getting default price.
However It gives correct values in $prices When I changed
$prices = $productItem->getRefItems( 'price', 'default', 'default' ); to $prices = $productItem->getRefItems( 'price', 'gold', 'default' ); (Where 'gold' is price type) in Controller files /ext/ai-controller-frontend/controller/frontend/src/Controller/Frontend/Basket/Standard.php
public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
But $this->summaryBasket price values are not getting updated as per price type.
Please help me to update price in summaryBasket in the view file.
Thanks
Harpal Singh
Re: How to get product price according to different user rol
Only the default price type is relevant when the customer put a product into the basket. All other price types are information and used for e.g. list price, price per month, price per m2, etc.
If you want to show different prices depending on the group of the logged in customer, you have to use the customer groups extension from the Aimeos company: https://aimeos.com/extensions/#c823
If you want to show different prices depending on the group of the logged in customer, you have to use the customer groups extension from the Aimeos company: https://aimeos.com/extensions/#c823
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