Answer the question
In order to leave comments, you need to log in
How to update the coefficient of the unit of measure in the sales catalog?
Hello, I rummaged through the entire Internet, and so I could not find a clear, working answer, how to update, or how to add this ratio ...
When adding a product, the RATIO parameter does not work
CCatalogProduct::Add(
array(
"ID" => $ID,
"QUANTITY" => $product->amount,
"RATIO" => $product->amount
)
);
CCatalogProduct::Update($ID, ["QUANTITY" => $product->amount, "RATIO" => $product->amount]);
\Bitrix\Catalog\ProductTable::update(19612, Array('RATIO' => 2));
CCatalogMeasureRatioAll::update(19612, Array('RATIO' => 2));
CCatalogMeasureRatio::update(5, Array('RATIO' => 2));
Answer the question
In order to leave comments, you need to log in
I found the answer to my question, in order to change this coefficient, you need to add it at the beginning through the function:
The above code will give us the necessary ID to update the coefficient through the function:
If there is a coefficient ID, it can be found through the function:
CCatalogMeasureRatio::getList(Array(), array('IBLOCK_ID' => 12, 'PRODUCT_ID' => 27387), false, false);
ProductTable::update must return an object of the Result class. See what's in it
$updateResult = \Bitrix\Catalog\ProductTable::update(19612, Array('RATIO' => 2));
print_r($updateResult);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question