S
S
Sergey2017-01-24 11:46:08
API
Sergey, 2017-01-24 11:46:08

Why Bitrix api removes information from orders?

Help with a problem. The order is collected and sent through the Bitrix API. At the next order, information from past orders is deleted ... i.e. only the last order is visible.

$arFields = array(
    "LID" => SITE_ID,
    "PERSON_TYPE_ID" => 1,
    "PAYED" => "N",
    "CANCELED" => "N",
    "STATUS_ID" => "N",
    "CURRENCY" => "rub",
    "USER_ID" => IntVal($USER->GetID()),
    "PAY_SYSTEM_ID" => $_REQUEST["payment"] == '1' ? '1' : '3',
    "PRICE_DELIVERY" => $_REQUEST["FreeOrderCost"],
    "DELIVERY_ID" => 2, // Доставка курьером
    "TAX_VALUE" => 0.0,
    "USER_DESCRIPTION" => $_REQUEST["comment"]
);
if (!CModule::IncludeModule("sale")) return;

$ORDER_ID = CSaleOrder::Add($arFields); // добавляется заказ
$ORDER_ID = IntVal($ORDER_ID);

CSaleBasket::OrderBasket($ORDER_ID); // добавляется корзина в заказ

CSaleOrderPropsValue::Update(1, array("VALUE" => $_REQUEST["name"], "ORDER_ID" => $ORDER_ID));
CSaleOrderPropsValue::Update(2, array("VALUE" => $_REQUEST["email"], "ORDER_ID" => $ORDER_ID));
CSaleOrderPropsValue::Update(7, array("VALUE" => $_REQUEST["addres"] . ", квартира " . $_REQUEST["flat"] . ", этаж " . $_REQUEST["floor"], "ORDER_ID" => $ORDER_ID));
CSaleOrderPropsValue::Update(3, array("VALUE" => $_REQUEST["phone"], "ORDER_ID" => $ORDER_ID));

these 4 fields are updated (id 1,2,7,3) .. if you delete the last 4 lines, then the information is not received in the new order and the old orders are not deleted.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Korolev, 2017-01-24
@UDAV99

There are properties with their own IDs, and there are order property values ​​that also have their own IDs and their own table.
CSaleOrderPropsValue::Update works exactly with property values. Therefore, it turns out that you are rebinding the values ​​of the properties of one order to a new order.
You need to use CSaleOrderPropsValue::Add to add new parameters to a new order.
https://dev.1c-bitrix.ru/api_help/sale/classes/csa...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question