• Как получать вариации товара через API Битрикс24?

    @Riaeiu
    Я вытащил через метод каталога. TYPE брать из метода crm.
    TYPE = 1 - простой товар
    TYPE = 4 - торговое предложение

    $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);