How to select all user orders with id 12 for February? According to the idea this is done through the API. Who can you tell me?

  • in the documentation, everything is there and even with examples - Mihanik71
  • But it is possible an example, otherwise everything is in the dock, but you cannot send an example of the code - bot

1 answer 1

In the first example from the CSaleOrder :: GetList documentation, insert the desired user ID into the filter.

<? // Выведем даты всех заказов текущего пользователя за текущий месяц, отсортированные по дате заказа $arFilter = Array( "USER_ID" => 12, ">=DATE_INSERT" => date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), mktime(0, 0, 0, date("n"), 1, date("Y"))) ); $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter); while ($ar_sales = $db_sales->Fetch()) { echo $ar_sales["DATE_INSERT_FORMAT"]."<br>"; } ?> 
  • But do not tell me how to add a discount for a specific user? - bot