E
E
Evgeny Nikolaev2020-01-17 12:37:35
1C-Bitrix
Evgeny Nikolaev, 2020-01-17 12:37:35

Product properties (material and size, both properties of the Enum type) are not displayed in the orders of the Bitirx administrative panel. How to make it appear?

In the Bitrix administrative panel in orders, if you go to a specific order next to the goods, I know that their properties can be displayed. I need to display the properties Material and Size (both are Enum lists).
Here is the place on the screenshot:
5e217e1fd25af008025052.jpeg
I add the goods to the cart via the API (that is, the component is not used), the Id of the TP or the goods to be added to the cart and the amount of the added goods or trade offer are transferred to a separate PHP file.
I add to the cart with the line: Add2BasketByProductID($PRODUCT_ID,$QUANTITY,array());
When placing an order, I simply pass the cart object to the order object, in short something like this:
$order = Order::create($siteId, $USER->isAuthorized() ? $USER->GetID() : $userIdTpm);
...setting $order for all types of payer and other things...
$basket = \Bitrix\Sale\Basket::loadItemsForFUser(\Bitrix\Sale\Fuser::getId(CSaleBasket::GetBasketUserID()), \Bitrix\ Main\Context::getCurrent()->getSite());
$order->setBasket($basket);
How can I make sure that the necessary properties are displayed in the orders in the admin panel? The product on which the value of the material property was tested and the size are exactly specified (or rather, its sales offer).
This is how the offer properties look like:
5e2180344117d497966901.jpeg
From the assumptions, when adding products to the basket by the Add2BasketByProductID function, you need to pass an array with the offer properties as the third parameter. If so, how exactly to do it for my case?
I also found the "Value is added to the cart" checkbox in the infoblock types in the trade offers on the properties tab if you click the change opposite the property, but it did not help to display the properties in the admin panel in orders, the checkmark is on the screen.
5e218f7de9d3c452994058.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
PetrPo, 2020-01-17
@nikolaevevge

At the top "change order", scroll to the composition of the order (as on your first screen), and there is a surprise in the form of a context menu joxi.ru/DmB3na7TJXeRQ2, set up the columns as you need))

R
Roman Gritsuk, 2020-01-17
@winer

In order for these properties to be displayed there, you need to add them (properties) to the basket. The checkbox "The value is added to the cart" only affects when using the standard template (or a template based on it).
You use the deprecated Add2BasketByProductID function to add a product to the cart

/**
 * @deprecated deprecated since catalog 17.5.9
 * @see \Bitrix\Catalog\Product\Basket::add
*/

Look in the code of the standard catalog.section or catalog.element component to see how adding a product to the cart is implemented. (Method \Bitrix\Iblock\Component\Base::addProductToBasket)
Or read API https://mrcappuccino.ru/blog/post/work-with-basket...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question