Magento Integration: Sales Order Synchronisation with Bundled Products
July 4, 2012 /
Posted in Integration Corner
We talked about how to handle Configurable Product in my previous blog. Today, I will show you the difference between the Bundled Product. In Magento, you can bundle a few Simple products together in Magento and sell it at a special price.
For example:
Bundle Product: My Computer Parts
Total Price: 450
Bundle Items:
- NZXT Lexa Silver Aluminum ATX Mid-Tower Case (Normal Price: 150)
- AMD A64 X2 3800+ 2.0GHz OEM (Normal Price: 100)
- Western Digital – 1TB HD – 7200RPM (Normal Price: 300)
From the Magento API, you will receive the following data in a Sales Order:
<item xsi:type=”ns1:salesOrderItemEntity”>
<item_id xsi:type=”xsd:string”>1</item_id>
<order_id xsi:type=”xsd:string”>1</order_id>
<product_id xsi:type=”xsd:string”>165</product_id>
<product_type xsi:type=”xsd:string”>bundle</product_type>
<sku xsi:type=”xsd:string”>mycomputerparts</sku>
<name xsi:type=”xsd:string”>My Computer Parts</name>
<price xsi:type=”xsd:string”>450.0000</price>
</item>
<item xsi:type=”ns1:salesOrderItemEntity”>
<item_id xsi:type=”xsd:string”>2</item_id>
<order_id xsi:type=”xsd:string”>1</order_id>
<product_id xsi:type=”xsd:string”>139</product_id>
<product_type xsi:type=”xsd:string”>simple</product_type>
<sku xsi:type=”xsd:string”>nzxtlexa</sku>
<name xsi:type=”xsd:string”>NZXT Lexa Silver Aluminum ATX Mid-Tower Case (Default)</name>
<price xsi:type=”xsd:string”>150.0000</price>
</item>
<item xsi:type=”ns1:salesOrderItemEntity”>
<item_id xsi:type=”xsd:string”>3</item_id>
<order_id xsi:type=”xsd:string”>1</order_id>
<product_id xsi:type=”xsd:string”>148</product_id>
<product_type xsi:type=”xsd:string”>simple</product_type>
<sku xsi:type=”xsd:string”>amda64</sku>
<name xsi:type=”xsd:string”>AMD A64 X2 3800+ 2.0GHz OEM</name>
<price xsi:type=”xsd:string”>100.0000</price>
</item>
<item xsi:type=”ns1:salesOrderItemEntity”>
<item_id xsi:type=”xsd:string”>4</item_id>
<order_id xsi:type=”xsd:string”>1</order_id>
<product_id xsi:type=”xsd:string”>149</product_id>
<product_type xsi:type=”xsd:string”>simple</product_type>
<sku xsi:type=”xsd:string”>1tb7200</sku>
<name xsi:type=”xsd:string”>Western Digital – 1TB HD – 7200RPM</name>
<price xsi:type=”xsd:string”>300.0000</price>
</item>
While you are synchronising a Sales Order to another system, you can’t copy all the prices of each item. It will give you a wrong total amount (450 + 150 + 100 + 300 = 1000). To overcome this situation, your integration logic should directly take the price of the Bundle product and ignore all the other prices from the Bundle items.