
VirtueMart Integration
208
Send the XML data on the queue by calling the sendMessage() function of
the MQClient.php le
2. Create the VMImport.java le and code the following steps:
Receive a message from the queue and get the XML message body
If the type on the incoming message is PURCHASEORDER:
Create an INSERT SQL statement by fetching the relevant eld values
from the XML and insert the record in the c_order table of ADempiere
that contains the purchase order details
Create an INSERT SQL statement by fetching the relevant eld values
from the XML and insert the record in the c_orderline table that
contains the line items (product and their quantities assigned) of a
purchase order
The c_order and c_orderline tables contain a good amount of columns that
require elaboration to be able to map the incoming VirtueMart data. You may refer to
http://www.adempiere.com/index.php/ManPageW_PurchaseOrder for all
the details related to the ADempiere purchase order and the two tables.
Alternatively, you may also use the Web Services to import data into ADempiere
Update the inventory counts for the products that are part of the order
With this, the order placed in the VirtueMart is now available in ADempiere as well.
How it works...
When the order is conrmed in Stage 4 of VirtueMart's checkout process (Step 2, if shipping
and payment is disabled), after the order is completely saved in VirtueMart and before
informing the user of the successful creation of the order, it created a message with the
type—PURCHASEORDER, and placed it on the queue. VMImport.java picks up the
message, and based on the type and the entity details, creates a PO in ADempiere.