Bitrix API

ProductRowSynchronizer implements LoggerAwareInterface uses LoggerAwareTrait

Synchronize order basket with deal product rows.

Main entity for that synchronizer - deal.

For example:

$order = \Bitrix\Crm\Order\Order::load($orderId);
$dealProductRows = \Bitrix\Crm\ProductRowTable::getList([
    'filter' => [
        '=OWNER_TYPE' => CCrmOwnerTypeAbbr::Deal,
        '=OWNER_ID' => $dealId,
    ],
])->fetchAll();

$synchronizer = new \Bitrix\Crm\Order\OrderDealSynchronizer\Products\ProductRowSynchronizer($order, $dealProductRows);
$result = $synchronizer->syncAndSave($withVerification);

Table of Contents

Interfaces

LoggerAwareInterface

Methods

__construct()  : mixed
sync()  : SyncResult
Synchronize basket items with product rows.
syncAndSave()  : Result
Synchronize basket items with product rows, and save order.
verify()  : Result
Verification the synchronization result and the order after synchronization.

Methods

__construct()

public __construct(Order $order, array<string|int, mixed> $productRows) : mixed
Parameters
$order : Order
$productRows : array<string|int, mixed>

sync()

Synchronize basket items with product rows.

public sync(bool $withVerification) : SyncResult

If deal product is new (not contains ID), then throw SynchronizeException, because new product row cannot linked with the basket item. If not found needed basket item by product row field XML_ID (aka basket item id), then it searching basket item by basket item field XML_ID (aka product row id with prefix). If deal product row not exists in basket, then it is created. If basket item not exists in product rows, then it is deleted.

Parameters
$withVerification : bool

if TRUE, then all changes to the basket (setting values, deleting an item, etc.) are processed with verification of the correctness of the operation.

Tags
throws
SynchronizeException
Return values
SyncResult

syncAndSave()

Synchronize basket items with product rows, and save order.

public syncAndSave(bool $withVerification) : Result
Parameters
$withVerification : bool
Return values
Result

verify()

Verification the synchronization result and the order after synchronization.

public verify() : Result
Return values
Result

        
On this page

Search results