An exportOrder API call is available for exporting a specified Order to a file.
The exportOrder interface requires an options parameters that is used to define the type of export to execute. Two examples that can be used for this code are:
When the KKConstants.EXP_ORDER_BY_SHIPPING_MODULE code is used, the idea is that the shipping module should provide an implementation of the order export that is specifically designed for integration with a shipping application for that shipping gateway.
An example of such a shipping module exportOrder implementation is provided for UPS for integration with UPS WorldShip. In this case the KonaKart order is exported as an XML file suitable for use with the Auto-Import feature of UPS WorldShip. The operator of UPS WorldShip should configure the Auto-Import directory (in UPS WorldShip) to be the directory where KonaKart exports its orders (by default, for store1 and UPS, this is under the KonaKart home directory in: orders/store1/2/ups/ where "2" is the value of the EXP_ORDER_BY_SHIPPING_MODULE constant, "ups" is the shipping module code, and "store1" is the storeId).
Two export order functions are available on the Orders panel of the Administration Application. These two export order functions correspond to the two export codes listed above (EXP_ORDER_FULL_ORDER_TO_XML and EXP_ORDER_BY_SHIPPING_MODULE). These functions are useful for ad-hoc order exports.
In some implementations of KonaKart it may be useful to export orders during normal order processing (rather than relying on manual intervention for this). There are many ways to implement the automatic export of orders. A common technique would be to use the OrderIntegrationMgr and AdminOrderIntegrationMgr to export orders whenever the order's status reached a certain value (such as "payment_received"). An example of doing just this is provided in the OrderIntegrtaionMgr source code and all that is required to get it to work is to uncomment the calls.
XML_IO is a tool, provided in the Enterprise Extensions of KonaKart, that allows you to import and export KonaKart data in XML files.
It can be found in the xml_io directory which is located directly under the KonaKart installation directory.
The XML_IO utility can be configured to backup KonaKart systems, transfer product data from one system to another (e.g. from some kind of staging system to the live system), or any other use you can think of involving the import and export of XML data!
For some users it may be a useful way to export products or orders in XML format for subsequent communication with other systems. Indeed it could also be a useful way to import customers or products into KonaKart that are defined in other systems that can produce compatible XML files.
These are merely examples and it is expected that users will end up using the XML_IO utility in many different ways to suit their own specific requirements.
A properties file allows you to define which KonaKart data objects you would like to be imported or exported providing tremendous flexibility of usage.
The properties file allows you to define the following:
When not modified, the default setting is true. #accessoryProducts = false #addressFormats = false #audit = false #bundledProducts = false #categories = false #categoriesToTagGroups = false #configurationGroups = false #configurations = false #countries = false #coupons = false #crossSellProducts = false #customerGroups = false #customerTags = false #customerTagsForCusts = false #currencies = false #customers = false #dependentProducts = false #digitalDownloads = false #expressions = false #geoZones = false #ipnHistory = false #languages = false #manufacturers = false #productOptions = false #orders = false #orderStatuses = false #productCategories = false #productOptionValues = false #products = false #productsToStores = false #reviews = false #subZones = false #tagGroups = false #tagGroupToTags = false #tags = false #taxClasses = false #taxRates = false #upSellProducts = false #wishLists = false #zones = false
The properties file allows you to define the data to be imported/exported using the Xml_IO import/export utility in KonaKart. You can call the properties file anything you like as its name is specified as an argument to the XML_IO command line utility (for details of the "usage" of the command line utility, see below).
If no properties are defined (or a properties file is not specified to the XML_IO utility) the default import/export configuration is used. By default all values are set to true. This means that by default all data is imported/exported. ** Note that this may take a long time if if you have a lot of data!
If you define properties in this configuration properties file the values in it will override the default settings of the XML_IO utility.
A sample file is provided in the download kit for you to modify for your own purposes. Uncomment only the fields you want to define for import/export.
If you leave them commented out "true" is used by default.
If you are planning to import your exported data into another system where the Ids of the data are different, you should ensure that you export the appropriate dependent data objects (see below for some warnings about mapping of Ids). If, on the other hand, you are planning to import the exported data into a system where you know the Ids of the referenced objects will be the same, you can improve the performance of the export/import process by choosing only the higher level objects for export and import. If in doubt, you should export and import all the data objects so that you know you have a complete set of data for the site.
You can discover the parameters for the XML_IO command line utility by issuing a "-?" as your argument as follows (example from a Linux system):
summersb@luton:~/konakart/xml_io$ . ./setClasspath.sh
summersb@luton:~/konakart/xml_io$ ${JAVA_HOME}/bin/java -cp ${IMP_EXP_CLASSPATH} \
com.konakart.importer.xml.Xml_io -?
Usage: Xml_io
(-i|-o) Import or Export
[-b bootstrapFile] Bootstrap file - an sql file run prior to importing
data to initialise the DB. If not set no bootstrap
is executed.
[-e emptyDBFile] An sql file used that's run prior to importing data
to empty the DB. If not set no empty DB is executed.
[-r xmlRootDir] Root directory of the XML data files on disk.
Default: ./xml_io
The directory is created if it doesn't exist.
[-prop propsFile] Konakart Admin properties file name which must be
on the classpath. Default:
konakartadmin.properties
[-conf confFile] Configuration file that defines which parts of the
KonaKart database are imported/exported.
[-usr userName] User name to access the Konakart Admin engine.
Default: admin@konakart.com
[-pwd password] Password to access the Konakart Admin engine.
Default: princess
[-s storeId] The store to import to or export from.
Default: store1
[-m engineMode] KonaKart Engine Mode
0 = Single Store (default)
1 = Multi Store MultipleDB
2 = Multi Store SingleDB
[-c (true|false)] Shared customers (only relevant in Engine Mode 2).
Default is false.
[-ps (true|false)] Shared products (only relevant in Engine Mode 2).
Default is false.
[-soap] Use SOAP to access the Admin Engine.
Default is to use direct java calls
[-ws url] The endpoint for the Admin Web Services. Default:
http://localhost:8780/konakartadmin/services/KKWSAdmin
Only relevant when -soap is specified
[-d] to enable debug
[-h|-?] to show usage information
A word of warning when using the XML_IO utility! Loading data from one system to another can be a very complicated process so proceed with extreme caution. It is suggested that you backup your systems before executing XML_IO imports in the event that an import doesn't function the way you expect.
Complications arise in a number of different areas. One is in the case where exported Ids (and keys) from one system do not match those on the target system to import into. The XML_IO utility does have the "intelligence" necessary to "map" these ids during the import process and does this in a number of different ways. One way to ensure the mappings are correct is to include the necessary reference data in the XML_IO export so that this can be used during the import process by XML_IO to figure out the correct mappings. An example is to include the languages export when you export the products so that when the products are subsequently loaded into a different system (where languages could easily be defined with different Ids) the language Ids can be mapped on the imported products.
Nevertheless, it is important to note that even when you include all the necessary reference data there are, unavoidably, occasions when XML_IO cannot calculate a mapping successfully. This can occur, for example, when it tries to locate a language by name in the target system (in order to figure out the mapping of Ids) but fails to find exactly one match. In such cases the XML_IO utility will report the mapping failure as a "Warning" in the log.
Therefore, it is strongly advised that you check your import/export processes carefully before unleashing in production. XML_IO is a very powerful utility but if used incorrectly can lead to duplicate records and in some cases a loss of integrity in your database.
In the xml_io directory, located under the KonaKart installation home directory, you will find some example scripts for running XML_IO either directly using the "engine" or via SOAP. These may be useful as they stand or they could be used as templates for your own XML_IO scripts that are tailored for your own particular environment.