Answer the question
In order to leave comments, you need to log in
How to attach products to a Bitrix24 lead?
Hi all.
I have such a question, it is necessary to integrate woocommerce with bitrix24.ru.
I added the sending of contact information, and it remains to send the goods that the client has chosen.
Here is the code that I got
$queryAddProductUrl = 'ССЫЛКА НА ВЕБХУК/crm.lead.productrows.set.json';
$queryAddProductData = http_build_query(
array(
'id' => $result['result'],
'rows' => array(
array(
'ID' => '1',
'PRODUCT_NAME' => 'Название товара',
'PRICE' => 200.00,
'QUANTITY' => 2
),
),
)
);
$curlAdd = curl_init();
curl_setopt_array($curlAdd, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryAddProductUrl,
CURLOPT_POSTFIELDS => $queryAddProductData,
));
$resultAddProduct = curl_exec($curlAdd);
curl_close($curlAdd);
$resultAddProduct = json_decode($resultAddProduct, 1);
Answer the question
In order to leave comments, you need to log in
When I did the integration, when transferring the goods, I also indicated PRODUCT_ID
In the loop, I filled the $rows array:
$rows[] = [
'PRODUCT_ID' => $product->sku,
'PRICE' => $product->price / 100,
'QUANTITY' => $product->quantity,
];
// Добавляем к сделки товары
$b24->crmDealProductrowsSet([
'id' => $b24Deal['result'],
'rows' => $rows,
]);
$b24 = new \Fomvasss\Bitrix24ApiHook\Bitrix24(variable('bitrix24_host'), variable('bitrix24_user'), variable('bitrix24_hook_code'));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question