magento order API determine if product belongs to a bundle
-
16-10-2019 - |
Question
I am extracting new orders in Magento using API. I would like to know how I can tell if this is a simple product, bundle or component of a bundle.
To get details I use soapObject method for sales_order.info
$details = $this->soapObject->call($this->sessionId, 'sales_order.info', $orderId);
when I dump details, it looks like this:
array(15) {
["product_id"]=>
string(3) "232"
["weight"]=>
string(6) "1.0000"
["sku"]=>
string(12) "BD22"
["name"]=>
string(28) "BUNDLED_PRODUCT22"
["qty_ordered"]=>
string(6) "2.0000"
["price"]=>
string(6) "0.0000"
["discount_percent"]=>
string(6) "0.0000"
["discount_amount"]=>
string(6) "0.0000"
["base_discount_amount"]=>
string(6) "0.0000"
["discount_invoiced"]=>
string(6) "0.0000"
["base_discount_invoiced"]=>
string(6) "0.0000"
["tax_percent"]=>
string(6) "0.0000"
["tax_amount"]=>
string(6) "0.0000"
["row_weight"]=>
string(6) "0.0000"
["price_incl_tax"]=>
string(6) "0.0000"
}
Solution
Try this :
$details = $this->soapObject->call($this->sessionId, 'sales_order.info', $orderId);
$productInfo = $this->soapObject->call($this->sessionId, 'catalog_product', $details['it_product_id'] );
You are interested in catalogProductReturnEntity=>type
. Read more here: http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalog_product.info.html
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange