Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
$response = $this->client->bxExecuteBatch([ 'productrows' => [ 'method' => 'crm.deal.productrows.get', 'params' => [ 'id' => $crm_deal_id, ], ], ]); $productrows = $response['result']['result']['productrows']; $request = []; foreach ($productrows as $row) { if (1 == $row['TYPE']) { // простой товар $request["product_{$row['PRODUCT_ID']}"] = [ 'method' => 'crm.product.get', 'params' => [ 'id' => $row['PRODUCT_ID'], ], ]; } elseif (4 == $row['TYPE']) { // торговое предложение $request["offer_{$row['PRODUCT_ID']}"] = [ 'method' => 'catalog.product.offer.get', 'params' => [ 'id' => $row['PRODUCT_ID'], ], ]; $request["product_{$row['PRODUCT_ID']}"] = [ 'method' => 'crm.product.get', 'params' => [ 'id' => '$result[offer_' . $row['PRODUCT_ID'] . '][offer][parentId][value]', ], ]; } else { throw new Exception('unexpected product row TYPE'); } } $response = $this->client->bxExecuteBatch($request);
TYPE = 1 - простой товар
TYPE = 4 - торговое предложение