Answer the question
In order to leave comments, you need to log in
How to pass data to a script?
According to those tasks, you need to insert order values into the script
<script type="text/javascript">
(window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
try {
rrApi.order({
transaction: <transaction_id>,
items: [
{ id: <product_id>, qnt: <quantity>, price: <price>},
{ id: <product_id>, qnt: <quantity>, price: <price> }
]
});
} catch(e) {}
})
</script>
<transaction_id> - ID транзакции,
<product_id> - ID товара (должно совпадать с ID, передаваемом в YML),
<qnt> - количество единиц товара в заказе,
<price> - цена за единицу товара.
<script type="text/javascript">
(window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
try {
rrApi.order({
transaction: 1235421421,
items: [
{ id: 12312, qnt: 4, price: 130 },
{ id: 64532, qnt: 1, price: 220 }
]
});
} catch(e) {}
})
</script>
<? echo "<pre>"; print_r($arResult[ORDER][ID]); echo "</pre>"; // ID транзакции
$obBasket = \Bitrix\Sale\Basket::getList(array('filter' => array('ORDER_ID' => $arResult[ORDER][ID])));
while($bItem = $obBasket->Fetch()){
echo $bItem['ID'].'<br/>'; // ID товара
echo round($bItem['QUANTITY'],2).'<br/>'; // количество единиц товара в заказе
echo round($bItem['PRICE'],2).'<br/>'; // цена за единицу товара
}
?>
12016 // ID транзакции
52280 // ID товара
1 // количество единиц товара в заказе
650 // цена за единицу товара
52281 // ID товара
1 // количество единиц товара в заказе
650 // цена за единицу товара
52282 // ID товара
3 // количество единиц товара в заказе
2790 // цена за единицу товара
Answer the question
In order to leave comments, you need to log in
Pass the object with the goods, and on the side of the popup already disassemble it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question