D
D
DenPolosin2017-01-29 22:27:49
PHP
DenPolosin, 2017-01-29 22:27:49

How to write to b_sale_basket_props table?

Bitrix 16.5.10.
I need to write basket properties to the b_sale_basket_props table using a script. I found how to write in b_sale_basket.

$basket = $newOrder->getBasket();
$item = self::getExistsItem($basket, 'catalog', $product['offer']['externalId']);
$item->setField('CUSTOM_PRICE', 'Y');
$item->setField('PRICE', $itemCost);
$item->setField('DISCOUNT_NAME', '');
$item->setField('DISCOUNT_VALUE', '');
$basket->save();

but I don’t know how to write it in b_sale_basket_props. Help write?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-01-30
@mrsoul

$basketPropertyCollection = $item->getPropertyCollection();
$basketPropertyCollection->setProperty([
    [
        'NAME' => 'Цвет',
        'CODE' => 'COLOR',
        'VALUE' => 'Красный',
        'SORT' => 100,
    ],
]);
$basketPropertyCollection->save();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question