Answer the question
In order to leave comments, you need to log in
How to add more than one product to Bitrix24 webhook lead using crm.lead.productrows.set ???
The code below adds a product to the lead, the problem is that it only adds one product. If there are 2 items to transfer, then only one last item is added.
$queryUrl = $this->bitrix_url'/crm.lead.productrows.set.json';
$queryData = http_build_query(array(
'id' => $leadID,
'rows' => array(
array(
"PRODUCT_ID" => $id,
"PRICE" => $price,
"QUANTITY" => $qty,
)),
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
Answer the question
In order to leave comments, you need to log in
Give what code you add 2 products.
inside should be something like
'rows' => array(
array(
"PRODUCT_ID" => $id,
"PRICE" => $price,
"QUANTITY" => $qty,
),
array(
"PRODUCT_ID" => $id2,
"PRICE" => $price2,
"QUANTITY" => $qty2,
)
),
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question