Document Properties
Kbid2G5870
Last Modified04-Feb-2020
Added to KB18-Jul-2014
Public AccessEveryone
StatusOnline
Doc TypeGuidelines, Concepts & Cookbooks
Product
  • ICM 7.6
  • ICM 7.7
  • ICM 7.8
  • ICM 7.9
  • ICM 7.10

Concept - Order Export

1 Introduction

This document deals with the intentions and concepts behind the order export. Orders can be exported in many ways regarding the export format as well as the technology. Exported orders are transmitted to or imported by 3rd party systems. Furthermore, the data that needs to be exported may differ among different customer deployments. This way, Intershop 7 provides a full-featured order export out of the box. An administrator should consider the contents of the present document rather as a blueprint of how customized export scenarios may be realized. So the Intershop 7 order export is referred to as an order export reference implementation in the further course of this document.

Intershop 7 uses the following functional components for order export:

  1. Order data export can be triggered synchronously by the Managed Services Framework and asynchronously by the Data Push Services Framework. The Data Push Services Framework is an extension of the Managed Services Framework tailored to the needs of asynchronous time triggered exports. Both frameworks represent common functionality that can be used to trigger synchronous and asynchronous export of Intershop 7 data.
  2. Order and Packing Slip Export has two functions:
    • Filtering the orders and their line items that should be exported and
    • Changing status values of the order, their line items and applied payment methods during import/export.
  3. The order export reference implementation explained in this document mainly specifies how an order is transformed from Intershop 7's internal representation to an external one.

With Intershop 7 complete orders can be exported, but, in contrast to previous ES6.x versions, not (re-)imported in Intershop 7 for the following reasons:

  • There are many new features, like extended promotions, gift wrapping and product configuration/customization, that have a direct impact on the structure of an order.
  • The new calculation framework introduced with Intershop 7 can handle complex cart calculation scenarios, with numerous intermediate calculation steps. So calculation of an order is only valid if it is done in the context of a running Enfinity instance with a specific configuration at a specific time (e.g., time triggered promotions).
  • The legacy ES6.4 order import will import the order into legacy columns that still are available. This is not a competitive solution.

Therefore, in Intershop 7 there is an export of complete order data and an import of status value updates.

If Intershop 7 has to meet additional customer-related requirements, the extension concept described later in this document can be used to export additional data. Or a new, completely different order export implementation has to be developed to meet those additional requirements.

Both, import and export functionality use XML as source/target format. However, with the Data Push Services Framework and Order Export Framework mentioned above various export/import formats and targets can be implemented.

Note

Basically, all data can be exported that are retrievable by accessing methods of related business objects and their extensions. It has to be noted that not all data, like certain product information of order line items, has to exist at the time the order export is triggered. Product information might be changed, or products might be removed in the meantime.

2 General Workflow of Order Export

workflow of order export

The order export consists of the following steps (see above diagram):

  1. Order export is triggered.
  2. The Data Push Services Framework starts an order export job.
    See the configuration ac_order_export_xml...services.component for details.
  3. An order search query bc_order_impex...OrderExportSearch.query searches for orders.
    The configuration is stored at the export job.
  4. A list of orders is passed to the export service.
  5. The order export service uses the OrderXMLWriter to serialize the order.
    The OrderXMLWriter uses JAXB. JAXB uses builders and binding classes to create XML. Builders are configured by the Component framework. Builders get the relevant data from the order-related business objects and their extensions.
  6. The export service writes the serialized orders to an OutputStream.
    This can be a file or a transport protocol to another system.
  7. Orders are exported.

3 Set Up an Order Export

3.1 Procedure

Enable the service in Organization Management Application:

  1. Log in to Commerce Management application of the organization.
  2. Select <Sales Organizations> | <Organization> | Services tab.
  3. Select teh Service Group Order Export Services.
  4. Enable Local XML File Order Export.

Create the service in Organization:

  1. Log in to the organization.
  2. Select Services.
  3. Click New.
  4. Click Order Export Services | Local XML File Order Export | Next >>.
  5. Type name and ID of your service, e.g., OrderExportService.
  6. Type for configuration a valid file location, and prefix e.g., c:\temp\orders.
  7. Share and activate your service.

Create export to run:

  1. Go to Orders | Import & Export.
  2. Click New.
  3. Give your export scenario a name.
  4. Select your desired service configuration, e.g., OrderExportService which was created in the previous step.
  5. Have a look at the tabs to configure your export.
  6. Go back to Orders | Import & Export.
  7. Select your export and run it.

To repeat an export, only run is required.

Note

In the Commerce Management application you can also create an export at the channel level. Here only orders of this channel are exported.

3.2 Cartridges and Cartridge Elements

The following elements of the order export reference implementation have to be considered:

  • Business objects and their extensions representing Intershop 7's public domain API.
  • Annotated binding classes represent XML schema types.
  • Builder classes act as link between business objects and XML binding classes by mapping information from business objects to XML binding classes.
  • XSD documents representing the external order format as XML schema. The XSD is directly created from XML schema types defined as javax.xml.bind.annotation.* annotations in XML binding classes. 
ConceptOrderExportRefImplCartridgeStructure2

4 Java-XML Binding

(Java->XSD) - Java classes, their attributes and methods are provided with annotations that control the transformation. A corresponding XML schema can be generated with the schemagen command line tool accompanied with J2SE. Please have a look at the  Cookbook - Order Export | Recipe: 3rd Party System Imports Orders Exported from IS7.

5 Extending / Changing the Export

This section outlines how to extend the export by adding an additional implementation.

Have a look at ac_order_export_xml\staticfiles\cartridge\components\instances.component. Here you can see how to instantiate a builder that can have sub-builders by using the fulfill statement. In this way the XML export file is constructed.

For example: The OrderShippingDiscountsBuilderImpl was introduced later. It should be placed in order-summary -> order-pricing -> pricing -> shipping-discounts. The tags order-pricing -> pricing already exist. Therefore, inside the fulfill tag of OrderExportXML-OrderPricing-Pricing the new OrderShippingDiscountsBuilderImpl was placed. By linking to the parent builder, you can achieve that the outer XML is left out if  the inner XML is empty.

The OrderShippingDiscountsBuilderImpl class gets a BusinessObject from the parent handler.

Use BO classes to determine data you need for this export.

The XML is represented in this case by the DiscountXML. The outer brace is the ShippingDiscountsXML class.

6 Automatic State Changes on Failure

The order export job supports to store a reason for a failed export. A reason is comprised of a reason code and a more detailed description. Both are set together with the status when it changes to state EXPORTFAILED. The reason is only displayed in the order details page of the Intershop 7 Commerce Management.

In order to use the feature the exception causing a export to fail must wrapped by or inherit from com.intershop.component.orderimpex.capi.export.order.OrderExportServiceException. All other exceptions (e.g., invalid order, Input/Output exception) lead to a termination of the export of this order.

6.1 Configuration

The configuration of the reason codes and their localizations are stored in the database. The involved tables - these are STATEDEFINITION, STATEINFORMATION and STATEINFORMATION_AV - are initialized during the DBInit using the preparer com.intershop.beehive.bts.dbinit.preparer.state.PrepareStateDefinitions.

Note

After the installation and creation of the first orders the reason codes must not be changed (except localization) or removed, because they may be in use.

6.2 Example

dbinit.properties
Class1  = com.intershop.beehive.bts.dbinit.preparer.state.PrepareStateDefinitions  \
          sample.order.dbinit.data.StateDefinition \
          sample.order.dbinit.data.StateInformation
StateDefinition.properties
#################################################
# Order status reason codes                     #
#################################################
OrderStatusReason;1000=DUPLICATE
OrderStatusReason;1100=INVALID_ARTICLE
StateInformation_en.properties
#################################################
# Order status reason codes                     #
#################################################
OrderStatusReason;1000=due to a duplicate order ID
OrderStatusReason;1100=order contains invalid data

7 Attachments

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets