Answer the question
In order to leave comments, you need to log in
How to display the price for a specific group of users in Bitrix?
Hello. Tell me, please, I'm already exhausted.
The user belongs to group 8(Wholesalers)
I need to display a different price for them
global $USER;
$arPrice = CCatalogProduct::GetOptimalPrice(6, 1, $USER->GetUserGroupArray(), "N");
Answer the question
In order to leave comments, you need to log in
Read the description of the CCatalogProduct::GetOptimalPrice method more carefully.
And then the description of the arUserGroups parameter:
An array of user groups. If it is empty, then the groups of the current user will be taken (provided that the $USER global variable of the CUser class exists, if not, the group with code 2 will be used).
If user groups are passed in the call, they will be forcibly added with a group code of 2 (All Users) if it does not exist.
\Bitrix\Main\Loader::includeModule('catalog');
$price = \Bitrix\Catalog\PriceTable::query()
->setSelect(['*'])
->setFilter([
'=PRODUCT_ID' => 123456,
'=CATALOG_GROUP_ID' => 7,
])
->exec()
->fetch();
print_r($price);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question