Answer the question
In order to leave comments, you need to log in
How to display the number of paid orders?
It is necessary for each user to display the number of paid orders (not the orders themselves, but only the total number). How can you do?
Answer the question
In order to leave comments, you need to log in
Use the new kernel :)
Bitrix\Main\Loader::includeModule('sale');
$orders = Bitrix\Sale\OrderTable::getList([
'filter' => [
'PAYED' => 'Y'
],
'group' => ['USER_ID'],
'select' => ['USER_ID', 'CNT'],
'runtime' => [
new Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(*)')
]
])->fetchAll();
$arFilter = array("USER_ID" => $USER->GetID(), 'PAYED' => 'Y');
$rsOrders = CSaleOrder::GetList(array('ID' => 'DESC'), $arFilter, array('PAYED', 'SUM' => 'PRICE'));
$arOrder = $rsOrder->Fetch();
echo $arOrder['CNT'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question