You are on page 1of 49

Advanced shipping configuration with WebSphere Commerce Calculation Framework

Jiu Zheng (James) Han Software Developer IBM China Lab, Beijing Alex Shum Software Developer IBM Toronto, Canada Dorothy Wu Content Editor IBM Silicon Valley Lab, San Jose October 10, 2007 Copyright International Business Machines Corporation 2007. All rights reserved.

Introduction
This article describes how to configure shipping charges in WebSphere Commerce. You can configure shipping charges by using the Shipping notebook in the WebSphere Commerce Accelerator, or manually set up more advanced shipping charges supported by the WebSphere Commerce calculation framework. This article provides an overview of the calculation framework, and the functions and limitations of the Shipping notebook. It then focuses on how to set up shipping charges by populating the calculation framework tables. Throughout this article, there are detailed procedures, sample scripts, and output examples so you can apply similar techniques in your environment.

Prerequisites
You need to know the following information: Basic knowledge of WebSphere Commerce Enterprise, Professional, or Express edition, version 5.6 or later, either B2C or B2B store models. Understanding of WebSphere Commerce concepts mentioned in this article, such as Order, OrderItem, shipping mode, shipping address, fulfillment center, shipping jurisdiction, and so on.

If you do not have these prerequisites, see the following WebSphere Commerce Information Center topics: WebSphere Commerce Information Center: Understanding (concepts) WebSphere Commerce Information Center: Easy start This article is intended for: Business users who are responsible for configuring shipping charges for their stores. Business partners who provide shipping configuration solutions. IBM service people who provide shipping solution and problem determination for WebSphere Commerce customers.

Calculation framework overview


Shipping charge is an important monetary amount that needs to be calculated during the order capture flow in a commerce system. Business rules and requirements specifying how and under what conditions the shipping charge amount is calculated vary for different merchants. The shipping charge is calculated based on the weight or quantity of the goods, the ship-from fulfillment center and ship-to address of the item, services provided by the shipping carrier (shipping mode), and so on. In WebSphere Commerce, the shipping charge configuration and calculation are handled by a flexible and configurable mechanism called the WebSphere Commerce calculation framework (hereafter called calculation framework). The calculation framework includes a set of tables in the WebSphere Commerce database schema and numerous calculation methods (task commands in WebSphere Commerce programming model) in different subclasses, according to the tasks they perform during the calculation process. The calculation framework is shared by the calculation of many charge types, such as shipping, tax, discount, and so on. This article focuses on the shipping charge calculation. All the shipping configuration data are stored in these calculation framework tables, and the customizable calculation methods are assembled in a configurable way to get the calculation result based on the data configured in these database tables. WebSphere Commerce provides a Shipping notebook in WebSphere Commerce Accelerator to help business operators configure the desired shipping scenarios. While the Shipping notebook has limitations in that it does not expose the advanced options of the calculation framework, it can only configure certain scenarios supported by the calculation framework. If you need to configure shipping scenarios that are not supported by the Shipping notebook, you need to understand how to configure shipping charges by using the calculation framework, including the calculation framework data models, and how the calculation framework elements work.

This section describes the following calculation framework elements: Calculation usage Calculation code Calculation rule Calculation rule qualification Calculation rule calculation Calculation method and runtime behaviors

Calculation usage
Calculation usage in the calculation framework represents the charge type in WebSphere Commerce. Currently, WebSphere Commerce has the following charge types, and each one has a corresponding calculation usage ID in the calculation framework as shown in the following table: Charge type Discount Shipping Calculation usage ID -1 -2 Description This is the adjustment to the TotalProduct of Order/OrderItem, including order and product promotions, and coupon promotions. This is the base shipping charge of the Order/OrderItem. The base shipping charge is the shipping charge before any shipping promotions and adjustments. This charge type is the focus in this article. In the sample code section, there are numerous references to the shipping charge configuration, calusage_id="-2". This is the tax based on the net price of the Order/OrderItem. This is the tax based on the total shipping charge of the Order/OrderItem. This usage is deprecated. It represents the coupon amount applied to the order. Surcharge is used to represent miscellaneous, such as charges or handling fees that cannot be included by other charge types. An example for the surcharge is PC recycling fee. Note: This calculation usage was added in WebSphere Commerce v5.7. This is the adjustment to the base shipping charge of the Order/OrderItem, including shipping promotion, contract based shipping adjustment, and CSR/TSR given shipping adjustments. Note: This calculation usage was added in WebSphere Commerce v6.0.

Sales tax Shipping tax Coupon Surcharge

-3 -4 -5 -6

Shipping adjustment

-7

Calculation code
A calculation code is an abstraction that defines how OrderItems are charged. The calculation code for shipping calculation usage is also known as the shipping code. This is simple as Charge $1.99 per item regardless of conditions, or more complex with different charge rates under different conditions.

At the beginning of the calculation process, the calculation framework needs to find all the available calculation codes for the given OrderItems. The calculation framework can do this because the calculation code is associated with OrderItems directly or indirectly. In the calculation framework, these two types of associations are called direct attachment and indirect attachment, respectively. a. Calculation code direct attachment: The calculation code direct attachment means the calculation code is associated with the Order or the OrderItem objects directly. Information relating a calculation code to an OrderItem is stored in the ORDICALCD database table, and information relating a calculation code to an Order is stored in the ORDCALCD database table. For more information about the calculation code direct attachment data model, see the Information Center. b. Calculation code indirect attachment: The calculation code indirect attachment means the calculation code is associated with items (or an items parent product) or product categories, so this calculation code is associated with the OrderItems indirectly during the shipping charge calculation. If one OrderItem has multiple calculation codes associated with it, by default all these calculation codes are returned and processed one by one in the predefined sequence of each calculation code. The calculation code indirect attachment is popular for configuring shipping charges because in most cases, the shipping charge rules are configured to associate with products or categories beforehand. They are not associated with specific Orders or OrderItems in runtime. The information relating the calculation code to catalog entries is stored in the CATENCALCD table. The information relating the calculation code to catalog groups or categories is stored in the CATGPCALCD table. For more information about the calculation code indirect attachment data model, see the Information Center. c. Default calculation code Besides the calculation code direct attachment and indirect attachment, you can implicitly associate the calculation code with OrderItems by specifying the default calculation code for a calculation usage in the STENCALUSG database table. The default calculation code is used for those OrderItems that do not have any direct attachments or indirect attachments explicitly. The Scenario 1 section has an example on how to setup the default shipping calculation code for a store.

Calculation rule
During the calculation process, after the calculation framework finds the available calculation codes for the given OrderItems, the calculation framework calculates the charge amounts for each calculation code. One calculation code can have one or more calculation rules, which are elements of the calculation code and defines how OrderItems under a particular set of conditions are charged. For example, the Charge by quantity calculation code can have two calculation rules:

Charge rate $1.99 per item for Regular Delivery and Charge rate $2.50 per item for Express Delivery. The properties for the calculation rules are defined in the CALRULE database table.

Calculation rule qualification


As described above, calculation rules of a calculation code do not always apply to the OrderItems that are associated with the calculation code because there are some specific conditions under which calculation rules can apply to the OrderItems. For example, there is a calculation code (Shipping charge for T-Shirt) used to calculate the shipping charge for a product T-shirt. This calculation code can have multiple calculation rules: For the OrderItems to be shipped with Express Delivery shipping mode, the shipping calculation rule ($2.50 for each goods) will apply. For the OrderItems to be shipped with Regular Delivery shipping mode, another shipping charge rule ($1.99 for each goods) will apply. For all shipping modes, one basic shipping charge rule might apply (fixed amount of $1.00).

In the calculation framework, the calculation rule qualification process checks whether specific OrderItems qualify for particular calculation rules. For the shipping charge rules calculation, the calculation rule qualification criteria is based on the relationship between the shipping mode, the fulfillment center, and shipping jurisdictions in which the shipping address fails. The SHPJCRULE database table defines the relationship between calculation rules, fulfillment centers, shipping jurisdiction groups, and shipping modes. They are the criteria for the Shipping calculation rule qualification. For more information about the shipping calculation rule qualification data model, see the Information Center.

Calculation rule calculation (calculation scale and range)


Each calculation rule calculates a monetary result for the associated OrderItems. This amount is determined by the calculation scales associated with the calculation rule. The amounts calculated by a calculation scale are determined by the calculation ranges and range values of the calculation scale, and determined by the configured calculation scale lookup method, and calculation range calculation method. In the Managing shipping configurations to bypass the shipping notebook section, you will see a few examples to compose different calculation scales and ranges to get different results. A calculation scale with a list of calculation ranges and associated range look-up results is represented as a table with two columns and multiple rows. The first column of the table corresponds to the calculation ranges of this scale, and the second column corresponds to the range lookup results, and the number of row equals to the number of the range and range lookup values.

The properties of the calculation scale are defined in the CALSCALE database table, and the relationship between the calculation rules and the calculation scales is stored in the CRULESCALE database table. The properties of the calculation ranges are defined in the CALRANGE database table. The properties of the associated range lookup results are stored in the CALRLOOKUP database table. See the calculation scale data model topic in the Information Center that represents the relationship between calculation rules, calculation scales, calculation ranges, and range lookup values.

Calculation method and calculation framework runtime behaviors


The calculation method is also known as the calculation command, which is a task command in the WebSphere Commerce programming model. The calculation method performs the calculation based on the information configured in calculation framework data models, so it represents the logic pieces in the calculation framework. One calculation method performs a specific task in the entire calculation process, a series of calculation methods work in assembly to finish the whole charge calculation. This provides much flexibility to assemble different sets of calculation methods to meet specific business requirements without programming changes. Later in this article, you will see many references of calmethod_id in the sample data. The selection of the proper calculation method in different cases is critical for the shipping charge configuration. The properties of the calculation method are stored in the CALMETHOD database tables. By default, the calculation framework provides many calculation methods for the selection of the configuration.

Shipping scenarios supported by the calculation framework


The calculation framework can support shipping charge calculation for various typical business scenarios. The supported shipping charge scenarios are based on a few elements. This provides

many samples to describe how these elements compose different shipping charge scenarios. The Managing shipping configurations to bypass the Shipping notebook section gives more complex sample scenarios and corresponding configuration data for these scenarios. The elements affecting the shipping charges are grouped into two groups: calculation group and qualification group.

Calculation group
Elements in the calculation group determine which shipping charge is calculated based on weight, quantity, price, and shipping elements. Weight The shipping charge of the OrderItem is calculated based on the weight of the OrderItem. For example, you can define the following shipping charge rules: Sample 1: Uniform by weight with per unit amount shipping charge. $0.50 per kg for the store: Each item in the order is charged $0.50 per kg for shipping, regardless of item types, shipping jurisdictions, shipping modes, and so on. For example, if the total weight of the OrderItems in the order is 10 kg, the shipping charge for this order is $5 ($0.50*10). Sample 2: Range based by weight with per unit amount shipping charge. This scenario is same as Sample 1, but it is range based, different ranges have different charge rates. Weight of the order (in unit of kg) Shipping charge (per unit amount) 0~10 $0.25 10~20 $0.20 20 and more $0.15 For example, if the weight of the order is 15, the shipping charge will be $3.0 (15*$0.2). Sample 3: Range based by weight with fixed amount shipping charge. This scenario is same as above Sample 2, but it is with a fixed amount. Quantity of the order (in unit of kg) Shipping charge (fixed amount) 0~10 $15 10~20 $20 20 and more $25 For example, if the weight of the order is 15, the shipping charge will be $20. You will see more weight based shipping charge scenarios and corresponding sample data in the Managing shipping configurations to bypass the Shipping notebook section. Quantity The shipping charge of the OrderItem is based on the quantity of the OrderItem. For example, you can define the following shipping charge rules. Sample 1: Uniform by quantity with per unit amount shipping charge.

$0.50 per item for the store: Each item in the order is charged $0.50 per item for shipping, regardless of item types, shipping jurisdictions, shipping modes, and so on. For example, if the total quantity of the order is 10, the shipping charge for this order is $5 ($0.50*10). Sample 2: Range based by quantity with per unit amount shipping charge. This scenario is the same as Sample 1, but it is range based, different ranges have different charge rates. Quantity of the order Shipping charge (per unit amount) 0~10 $0.25 11~20 $0.20 21 and more $0.15 For example, if the quantity of the order is 15, the shipping charge will be $3.00 (15*$0.2). Sample 3: Range based by quantity with a fixed amount shipping charge. This scenario is same as Sample 2, but it is with a fixed amount. Quantity of the order Shipping charge (fixed amount) 0~10 $15 11~20 $20 21 and more $25 For example, if the quantity of the order is 15, the shipping charge will be $20. You will see more quantity based shipping charge scenarios and corresponding sample data in the Managing shipping configurations to bypass the Shipping notebook section. Price The shipping charge of the OrderItem is based on the price of the OrderItem. The price mentioned here is a non-discounted price (ORDERITEM.TOTALPRODUCT), net price (discounted ORDERITEM.TOTALPRODUCT), unit price (discounted per unit price or sum(ORDERITEM.PRICE, or sum(discounts of the OrderItem). For example, you can define the following shipping charge rules. Sample 1: Uniform by net price with percentage shipping charge. 10% net price as shipping charge: For each order, the shipping charge amount is 10% of the net price of the order. For example, if the orders net price is $100, the shipping charge is $10($100*10%). Sample2: Range based by net price with percentage shipping charge. This is the same as Sample 1, but it is range based, different ranges have different percentage values. Net price of the order Shipping charge (percentage value) $0~$10 25% $10~$20 20% $20 and more 15% For example, if the net price of the order is $15, the shipping charge will be $3.00 ($15*20%).

Sample 3: Range based by net price with fixed amount shipping charge. This is the same as Sample 2, but it is with a fixed amount. Net price of the order Shipping charge (fixed amount) $0~$10 $15 $10~$20 $20 $20 and more $25 For example, if the net price of the Order is $15, the shipping charge will be $20. Sample 4: Range based by non-discounted price with fixed amount shipping charge. This is the same as Sample 3, but it is by non-discounted price. Non-discounted price of the order Shipping charge (fixed amount) $0~$10 $15 $10~$20 $20 $20 and more $25 For example, if the non-discounted price of the order is $15, the shipping charge will be $20. Sample 5: Uniform by unit price with fixed amount shipping charge. This is the same as Sample 4, but it is by unit price. Unit price of the order Shipping charge (fixed amount) $0~$10 $15 $10~$20 $20 $20 and more $25 For example, if the unit price of the order is $15, the shipping charge will be $20. Shipping The shipping charge of the OrderItem is also based on the shipping calculation results of other shipping charge rules. For example, according to Rule A, you get a shipping charge of $10. There is another Rule B, which requires adding an additional 10% of existing shipping charge. Rule A is calculated prior to Rule B. The final shipping charge for the order is $11 ($10+$10*10%).

Qualification group
Elements in the qualification group determine which shipping charge is calculated. Product, Order/OrderItem, member group, shipping address, shipping mode, and fulfillment center are elements in the qualification group. Product Different products or the products in different categories can have different shipping charge rules. Sample 1: Different products (or items) have different shipping charge rules. Product or item Shipping charge rule T-shirt Uniform $0.50 per item Wing Chair Uniform $0.50 per kg For example, if you buy two T-shirts and one Wing Chair (weight is 10kg), the shipping charge is $6 ($0.50*2 + $0.50*10).

Sample 2: Different categories have different shipping charge rules. Category Shipping charge rule Kitchenware Uniform $0.50 per item Furniture Uniform $0.50 per kg For example, if you buy one frying pan, the shipping charge is $0.50. If you buy one Lounge Chair (weight is 10kg), the shipping charge will be $5 ($0.5*10). Order or OrderItem Different Order or OrderItem can also have different shipping charge rules. This scenario is used during the negotiation between the shopper and CSR. The shopper asked for a particular shipping charge rules ($0.50 per item) for his order, while another shopper asked for another shipping charge rule ($5 fixed amount) for his order. Member Group Customers in different store member groups can have different shipping charge rules. Sample 1: Different member groups have different shipping charge rules. Member group Shipping charge rule Guest user Uniform $0.50 per kg Registered customer Uniform $0.40 per kg VIP customer Uniform $0.30 per kg For example, for the same goods, if you buy it as guest user (you do not have a registered account or do not log in the store), the shipping charge for this goods is $0.50 per kg. If you are a registered customer and you log in the store, the shipping charge for the same goods is $0.40 per kg. If you are VIP person, you get the lowest shipping charge rate of $0.30 per kg. Fulfillment options (combination of shipping mode, shipping address, and fulfillment center) The OrderItems shipped with different shipping modes (also called shipping methods determined by shipping carrier and service provided), shipped to different shipping jurisdictions, and shipped from different fulfillment centers can have different shipping charge rules. Sample1: Different shipping modes have different shipping charge rules. Shipping mode Shipping charge rule Regular Delivery (5 days) Uniform $0.40 per kg Express Delivery (3 days) Uniform $0.50 per kg Overnight Delivery (1 day) Uniform $0.60 per kg For example, if your order has two OrderItems, the first OrderItem (5 kg) is shipped with Regular Delivery. If you want the other OrderItem (2 kg) to be shipped with Overnight Delivery, the shipping charge for first OrderItem is $2.00. The shipping charge for the second OrderItem is $1.20. The total shipping charge for the order is $3.20. Sample 2: Different shipping jurisdictions have different shipping rules. Shipping jurisdiction Shipping charge rule United State Uniform $0.40 per kg China Uniform $0.50 per kg World Uniform $0.60 per kg For example, if your order has three OrderItems (each OrderItems weigh is 1 kg). The first OrderItem is shipped to United States, the second OrderItem is shipped to China, and the third

10

OrderItem is shipped to Canada. The shipping for the first OrderItem will be $0.40, the shipping charge for the second book is $0.50, and the shipping charge for the third book is $0.60.The total shipping charge for the order is $1.50. Sample 3: Different fulfillment centers have different shipping rules. Fulfillment center Shipping charge rule North America storehouse Uniform $0.40 per kg Asia Pacific storehouse Uniform $0.50 per kg For example, your order has two OrderItems. One OrderItem is shipped from the North America storehouse fulfillment center, the other is shipped from the Asia Pacific storehouse fulfillment center. The shipping for the first OrderItem will be $0.40, and the shipping charge for the second OrderItem is $0.50, so the total shipping charge for the order is $0.90. You can also configure different shipping charge rules for different combination of shipping jurisdictions, shipping modes, and fulfillment centers.

Managing shipping configurations with shipping notebook


WebSphere Commerce provides a Shipping notebook in WebSphere Commerce Accelerator to help the system administrator to manage the shipping charge configurations. With the Shipping notebook, the administrators with Operation Manager (B2C) or Logistic Manager (B2B) and Sell roles can easily manage the shipping configuration. Figure 1. Shipping management

Shipping jurisdictions
You can use the Shipping notebook to create and manage shipping jurisdictions, including managing the shipping jurisdiction groups and the relationship between the jurisdictions and jurisdiction groups.

11

Figure 2. Shipping jurisdiction management

Shipping modes
You can use the Shipping notebook to create and manage shipping modes as shown in Figure 3. Figure 3. Shipping mode management

Shipping code
The most important function of the shipping GUI is to create and manage typical shipping charge configurations, including shipping codes (calculation codes) as shown in Figure 4.

12

Figure 4. Shipping mode management

Figure 5 shows the shipping code managing notebook that creates calculation codes that attach products, items, and categories with the calculation code. Figure 5. Sshipping code change - assign shipping codes to products or categories

Shipping charges
You can also use the Shipping notebook to manage the shipping charge rules under the shipping code.

13

Figure 6. Shipping charge rules management

When creating shipping charge rules for the shipping calculation code, the following figure is used to restrict the shipping rule to specific shipping mode, shipping jurisdiction, and fulfillment center combinations. Figure 7. Create shipping charge rule - fulfillment option creation

The Shipping notebook supports by quantity or by weight scenarios. The fixed amount shipping charge scenario is independent of the quantity or weight as shown in Figure 8. Figure 8. Create shipping charge rule shipping charge types

Figure 9 shows the range based by quantity with per unit amount (Sample 2 in Quantity scenarios in the Shipping scenarios section.

14

Figure 9. Create shipping charge rule - shipping charge ranges

Figure 10 shows range based by weight with per unit amount (Sample 2 in Weight scenarios in the Shipping scenarios section). Figure 10. Create shipping charge rule - shipping charge ranges

Figure 11 shows the fixed amount shipping charge independent of the quantity or weight. Figure 11. Create shipping charge rule - fixed shipping charge type

15

Managing shipping configurations to bypass the Shipping notebook


The Shipping notebook helps operators manage shipping configurations for simple shipping charge scenarios. However, it does not expose the advanced options, which are supported by the calculation framework. To leverage the advanced options provided by the calculation framework, you need to bypass the Shipping notebook to configure the advanced shipping scenarios. You need to configure these advanced shipping charge scenarios by populating the calculation framework database tables directly. There are three ways to configure shipping charges to bypass the Shipping notebook: Using SQL statements Using idresolve and massload utilities Using XSD and XSLT technology

Using SQL statements


For example, perform the following SQL to create a shipping calculation code:
insert into calcode (calcode_id, code, calusage_id, storeent_id, groupby, published, sequence, combination, calmethod_id, calmethod_id_app, calmethod_id_qfy, displaylevel, flags, precedence) values (10001, 'Shipping Code 1', -2, 10101, 8, 1, 1.0, 0, -23, 24, -22, 0, 0, 0);

You need a good understanding about the calculation framework, especially on the calculation framework data models. You also need to compose and maintain the unique identifier for each entry. For example, in this case, provide valid values for the calcode_id column and maintain the calcode_id column in many other tables, which refer to the calcode.calcode_id column.

Using idresolve and massload utilities


For example, write the following line in a XML file, and then use idresolver to resolve the unique identifier used in this XML file, and massload utilities to load the resolved XML data into the database tables to create a shipping calculation code:
<calcode calcode_id="@calcode_id_10001" code="Shipping Code 1" calusage_id="-2" storeent_id="10101" groupby="8" published="1" sequence="1.0" combination="0" calmethod_id="-23" calmethod_id_app="-24" calmethod_id_qfy="-22" displaylevel="0" flags="0" precedence="0"/>

Comparing with the SQL statements, this avoids composing and maintaining the unique identifier of the database tables, but you still need a good knowledge and understanding about the database

16

schema definitions. Note: For more information about how to use idresolver and massload utilities to populate the database table in WebSphere Commerce, see the idresolver utility and mass load topics in the Information Center.

Using XSD and XSLT technology


If you do not have deep knowledge about the calculation framework, and do not understand all the columns of the calculation database tables, this article provides the following logical shipping charge configuration XML Schema (XSD) and the XSL Transformation (XSLT) templates in the codesample.zip file: Shipping XSD Shipping to Massload XSLT Massload to Shipping XSLT

With the provided shipping XSD, the system administrators can configure the shipping charge in a hierarchical view for the logical calculation objects. The administrator does not need to know the detail definitions for the physical database schema defamations because the shipping2massload XSLT can transform the logical data to physical schema data, then use the idresolve and massload utilities to load the translated data to the WebSphere Commerce database. Another advantage is that the administrator only needs to provide the key attributes for the logical objects, and the XSLT templates can intelligently provide the default values for other attributes. The administrator only needs a primary concept of the calculation framework and basic knowledge about the calculation framework data models. The administrator can focus more on the business when configuring the shipping charges, rather than technical details of calculation framework itself. The next section provides the sample data for some typical shipping configuration scenarios that are commonly used by many customers. This sample data is given in XML format and complies with shipping.xsd. As to the step-by-step instructions on using the shipping XSD and the shipping to massload and massload to shipping XSL transforms templates, see the Discussion section of the Variation A of Scenario 1. Notes: The XSD and XSLT provided in this article are not shipped with the WebSphere Commerce product, so they are not officially supported by the product. You can only use them for reference purposes. The Shipping notebook does configure the advanced shipping scenarios, and it does not display the advanced shipping scenario data configured to bypass the Shipping notebook. This means that

17

after you configured the shipping charge scenarios, you cannot manage (display and update) these configured scenarios in the Shipping notebook in WebSphere Commerce Accelerator.

Sample data for typical shipping configuration scenarios


The previous sections introduced the calculation framework and the shipping charge scenarios supported by the calculation framework. This section focuses on how to compose the configuration data in XML format to implement these scenarios. All the scenarios given here are common for many businesses. You can directly use some samples in your business, or modify them by following the discussion for each scenario to match your business requirements. All 25 sample scenarios in this section were verified using WebSphere Commerce v6.0.

Instructions using the Shipping XSD


This section provides the following scenarios. Most of these scenarios discuss the problem, a solution, and a short discussion. Scenario 1. Setup weight based shipping charges Scenario 2. Setup quantity based shipping charges Scenario 3. Setup price based shipping charges Scenario 4. Setup product dependent shipping charge Scenario 5. Setup member group dependent shipping charge Scenario 6. Setup fulfillment option (combination of shipping mode, shipping jurisdiction, and fulfillment center) dependent shipping charges

Follow these instructions to use the Shipping XSD, shipping2massload/massload2shipping XSL, and the transform templates to practice the sample scenarios: 1. Edit the sample XML data according to your own environment. For example, you might need to edit the storeent_id, store_id, shipmode_id, catentry_id, and so on for your environment and your scenario. You might need to write your own XML data starting from the solution close to your own business scenarios, but keep in mind that your configuration XML format must follow the schema definition in shipping.xml. 2. Use an XSL conversion tool to transform the configuration XML file to the XML file, which is ready to do Idresolver. You can use the XML transfer tool provided by Rational Application Developer, or the xmltransform.bat utility provided by WebSphere Commerce. For example:
<WC_Dir>/bin/xmltransform -infile recipe1a.xml -transform shipping2massload.xsl -outfile recipe1a.output.xml

18

3. Edit the transferred XML to add the XML Document Type Definition (DTD), and remove the attributes of the XML root element (import).

Change upper lines to the following lines. Note the path of the wcs.dtd should match the path in your environment.

4. Using the idresolver utility to resolve the ID for the converted XML. For example:
<WC_Dir>/bin/idresgen recipe1a.output.xml recipe1a.resolved.xml

5. Use the massload utility to load the resolved XML data to the database. For example:
<WC_Dir>/bin/massload recipe1a.resolved.xml

6. Restart the WebSphere Commerce server, or update the calculation registry to make the configuration take effect. 7. Verify your configuration by implementing the shopping flow. If you want to change the configuration data, you can follow steps to mass extract the configuration data from the database, then use the massload2shipping.xsl template to convert the physical data (massload compliance) to logical data (shipping.xsd compliance). You can edit the configuration and follow the previous steps to load the new configuration to the database.

Scenario 1. Setup weight based shipping charges


This section describes: a. Uniform by weight with per unit amount shipping charge b. Range based by weight with per unit amount shipping charge c. Cumulative range based by weight with per unit amount shipping charge d. Range based by weight with fixed amount shipping charge e. Range based by each OrderItems weight with fixed amount shipping charge f. Cumulative range based by weight with combination of fixed amount and per unit amount shipping charge g. Fixed amount shipping charge spread by weight (uniform by weight with fixed amount shipping charge) a. Uniform by weight with per unit amount shipping charge Problem $0.50 per kg for the store: The order is charged $0.50 per kg for shipping regardless of item types, shipping jurisdictions, shipping modes, and so on. For example, if the total weight of the OrderItems in the order is 10 kg, the shipping charge for this order is $5 ($0.50*10).

19

Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> Discussion This is a simple shipping configuration that showcases many of the essential elements of any shipping configuration. First, we have the calculation code. As explained previously, a calculation code is an abstraction that defines how OrderItem is charged. It is as simple as Charge $0.50 per kilogram regardless conditions as in this example, or it is complex with different conditions, as we will demonstrate in later examples. Given that you want to charge the same rate of $0.50 per kg, regardless of the item type, you need to define only one calculation code. Generally, define as many as calculation codes as the number of item types you want to charge differently. Note that the calculation code is set as the default by setting the STENCALUSG.CALCODE_ID value to its unique ID. A calculation code has to be attached to categories/products/items, and set as the default for it to take effect. Scenario 4 shows how the calculation code attaches to products, items, and categories. Next is the calculation rule. As explained previously, calculation rules are subcomponents of calculation codes, and each defines how an OrderItem under a particular set of conditions is charged. Typically, we are talking about the fulfillment center of the OrderItem, as well as its shipping jurisdiction and shipping mode. In this example, you need to define only one calculation rule. Note that its CALRULE.FLAGS is set to 0, meaning that it does not have any conditions. Scenario 6 shows you calculation rules that do have conditions. Also note that the calculation rule is associated with a calculation scale, which defines the rates.

20

Last is the calculation scale. Each calculation scale contains a set of calculation ranges and corresponding range lookup results, representing rates under different ranges of quantity, weight, and so on. The calculation scale is CALSCALE.CALMETHOD_ID with a value of -29, meaning that the calculation scale is weight based. This value affects the ranges as well as rates. The possible values of CALSCALE.CALMETHOD_ID include: -28: The range and rate are quantity-based, such as $0.50 shipping charge per item. -29: The range and rate are weight-based, such as $0.50 shipping charge per kg. -30: The range and charge are non-discounted price based, such as $0.50 shipping charge for the order with non-discounted price more than $1000, and $0.30 shipping charge for the order with non-discounted price under $1000. -31: The range and rate are net price based, such as $0.50 shipping charge for the order with a net price more than $1000. -32: The range and charge are unit price, such as $0.50 shipping charge for items with a unit price of more than $100.

Note: If you selected -29 (weight based) as the CALSCALE.CALMETHOD_ID, ensure that all goods you bought have the weight data configured in the CATENTSHIP table. Otherwise, the calculation framework cannot calculate the charge for the order. Another attribute to note is CALRANGE.CALMETHOD_ID, which determines the lookup result (such as the rate) type. A value of -34 means that the rate represents a per unit amount, for example, $0.50 per kg. All the possible values of CALRANGE.CALMETHOD_ID include: -33: The rate represents a fixed amount, such as a flat $0.50 charge. -34: The rate represents a per unit amount, such as $0.50 per kg. -35: The rate represents a percentage charge, such as 10% of the non-discount price.

b. Range based by weight with per unit amount shipping charge Problem This scenario is similar with Variation A of Scenario 1, but it is range based, different ranges have different charge rates. Weight of the order (in unit of kg) Shipping charge (per unit amount) 0~10 $0.25 10~20 $0.20 20 and more $0.15 For example, if the weight of the order is 15, the shipping charge will be $3.00 (15*$0.2). Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34">

21

<calrlookup value="0.25" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-34"> <calrlookup value="0.20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-34"> <calrlookup value="0.15" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

Discussion Comparing with the solution of Variation A of Scenario 1, there is only one difference. There are multiple calculation ranges under the calculation scale, and each range has its own calculation range lookup value representing different charge rates for this range. c. Cumulative range based by weight with per unit amount shipping charge

Problem This scenario is similar with Variation B of Scenarion 1, but it is cumulative range based. The result is cumulated from the result of different ranges. Weight of the order (in unit of kg) Shippingcharge (per unit amount) 0~10 $0.25 10~20 $0.20 20 and more $0.15 For example, the weight of the order is 25 kg. The 0~10 portion will be charged $0.25 per kg, the 10~20 portion will be charged $0.20 per kg, and the portion of more than 20 will be charged $0.15 per kg. The total shipping charge for the 25 kg order is $0.25*10+$0.20*10+$0.15*(25-20)=$5.25. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34" cumulative="1">

22

<calrlookup value="0.25" setccurr="USD" /> </calrange> <calrange cumulative="1"> <calrlookup value="0.20" setccurr="USD" /> </calrange> <calrange cumulative="1"> <calrlookup value="0.15" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> rangestart="20" calmethod_id="-34" rangestart="10" calmethod_id="-34"

Discussion Comparing with the solution of Variation B of Scenario 1, there is only one difference. All the calculation ranges have the cumulative attribute with a value of 1, which means these calculation ranges are cumulative. d. Range based by weight with fixed amount shipping charge Problem This scenario is similar to Variation B of Scenario 1, but it is with a fixed amount rather than per unit amount. Weight of the order (in unit of kg) Shipping charge (fixed amount) 0~10 $15 11~20 $20 21 and more $25 For example, if the quantity of the order is 25, the shipping charge will be $25. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="15" setccurr="USD" />

23

</calrange> <calrange rangestart="10" calmethod_id="-33"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-33"> <calrlookup value="25" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

Discussion Comparing with the solution of Variation B of Scenario 1, there is only one difference. All the calculation ranges have the CALRANGE.CALMETHOD_ID attribute with a value of -33, which means the charge rate of the range represents a fixed amount. e. Range based by each OrderItems weight with fixed amount shipping charge

Problem This scenario is similar to Variation D of Scenario1, but the shipping charge is calculated per OrderItem. Weight of the Order (in unit of kg) Shipping Charge (Fixed Amount) 0~10 $15 11~20 $20 21 and more $25 For example, given an order with two OrderItems, the weight of this order is 25 kg. For the OrderItems, the first one is 7 kg, the other is 18 kg. The shipping charge for the first OrderItem is $15, and the shipping charge for the other OrderItem is $20, so the total shipping charge is $15+$20=$35. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="15" setccurr="USD" />

24

</calrange> <calrange rangestart="10" calmethod_id="-33"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-33"> <calrlookup value="25" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1" groupby="32"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

Discussion Comparing with the solution of Variation D of Scenario 1, the only difference is that the calculation code has the CALCODE.GROUPBY with a value of 32, which means the calculation group of this calculation code is grouped by OrderItems. In the calculation framework, the OrderItems applicable to the same calculation code are grouped into one or more calculation groups in some way. One calculation group includes one calculation code and a list of OrderItems attached to this calculation code. The calculation is based on the group. The CALCODE.GROUPBY column contains the bit flags, which control the grouping. The supported big flags are: 0 - No grouping, this means all the OrderItems applicable to the same calculation code will be in the one group. 1 - Group by product, this means all the OrderItems with the same catalog entry ID or parent product ID will be grouped together. 2 - Group by contract, this means all the OrderItems bought under the same contract (OrderItems.trading_id) will be grouped together. 4 - By offer, all the OrderItems with the same offer price (OrderItems.offer_id) will be grouped together. 8 - By address, all the OrderItems with the same shipping address (OrderItems.address_id) will be grouped together. 16 - By order release number, all the OrderItems with the same order release number (OrderItems.ordreleasenum) will be grouped together. 32 - By OrderItem, each OrderItem will be in an individual group.

You can combine these bit flags to create new group ways. For example, if you want the OrderItems with the same products and the same shipping destinations have a fixed amount of

25

shipping charges, you can configure this flag to 5 (=1+4) to make these OrderItems group together, then calculate together. f. Cumulative range based by weight with combination of fixed amount and per unit amount shipping charge

Problem This scenario is the combined solution of Variations B and D of Scenario 1. Weight of the order (in unit of kg) Shipping charge 0~10 $15 (fixed amount) 10 and more $0.50 (per unit amount) For example, given the weight of the order is 25kg, the 0~10 kg portion of the order will be charged a fixed amount of $15 for shipping. The shipping charge for the remaining portion is 15*0.50=$7.50. The total shipping charge for the order is $22.50. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-33" cumulative="1"> <calrlookup value="15" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-34" cumulative="1"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> Discussion This solution is combined from Variation B and Variation D. There are two cumulative calculation ranges for the calculation scale. The first range has the CALRANGE.CALMETHOD_ID value of -33, representing the fixed amount charge rate. The second range has the CALRANGE.CALMETHOD_ID value of -34, representing the per unit amount charge rate.

26

g. Fixed amount shipping charge spread by weight (uniform by weight with fixed amount shipping charge) Problem This solution is similar to Variation A of Scenario 1, but it is with a fixed amount charge rate instead of per unit amount charge rate. For example, a $10 shipping charge for the store, independent of item types, weight, quantity, and so on. The $10 shipping charge is spread to the OrderItems by their weight. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="10" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> Discussion The only difference between this solution and the solution of Variation A is that the calculation range has a CALRANGE.CALMETHOD_ID value of -33, which means the rate for this range is a fixed amount. Note that we also have a calculation scale, CALSCALE.CALMETHOD_ID value of -29, in this solution while the shipping charge is weight independent. In fact, you can get the same shipping charge result by changing this value to any other applicable calculation scale lookup method. However, if you want the shipping result spread to OrderItems by their weights, you must use -29 here.

27

Scenario 2. Setup quantity based shipping charges


This section describes: a. Uniform by quantity with per unit amount shipping charge b. Range based by quantity with per unit amount shipping charge c. Cumulative range based by quantity with per unit amount shipping charge d. Range based by quantity with fixed amount shipping charge e. Range based by each OrderItems quantity with fixed amount shipping charge f. Cumulative range based by quantity with combination of fixed amount and per unit amount shipping charge g. Fixed amount shipping charge spread by quantity (uniform by quantity with fixed amount shipping charge) a. Uniform by quantity with per unit amount shipping charge Problem $0.50 per item for the store: The order is charged $0.50 per item for shipping, regardless of item types, shipping jurisdictions, shipping modes, and so on. For example, if the total quantity of the OrderItems in the order is 10, the shipping charge for this order is $5 ($0.50*10). Solution <?xml version="1.0" encoding="UTF-8"?>
<import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

Discussion Comparing with the solution of Variation A of Scenario 1, there are two changes. In this solution, we changed the CALSCALE.CALMETHOD_ID value from -29 to -28, which means this calculation scale and ranges are quantity based instead of weight based, and changed the
28

CALSCALE.QTYUNIT_ID to C62 representing the default unit of measure of one. By making the similar change to the solutions of other variations of Scenario 1, you can get the corresponding by quantity solutions. This section describes scenarios and solutions only for Variations B to G. b. Range based by quantity with per unit amount shipping charge Problem Quantity of the order Shipping charge (per unit amount) 0~10 $0.25 11~20 $0.20 21 and more $0.15 For example, if the quantity of the order is 15, the shipping charge will be $3.00 (15*$0.20). Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.25" setccurr="USD" /> </calrange> <calrange rangestart="11" calmethod_id="-34"> <calrlookup value="0.20" setccurr="USD" /> </calrange> <calrange rangestart="21" calmethod_id="-34"> <calrlookup value="0.15" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

29

c.

Cumulative range based by quantity with per unit amount shipping charge

Problem Quantity of the order Shipping charge (per unit amount) 0~10 $0.25 11~20 $0.20 21 and more $0.15 For example, given the quantity of the order is 25, the 0~10 portion will be charged $0.25 per item, the 10~20 portion will be charged $0.20 per item, and the portion of more than 20 will be charged $0.15 per item. The total shipping charge for the order is $0.25*10+$0.20*10+$0.15*(2520)=$5.25. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-34" cumulative="1"> <calrlookup value="0.25" setccurr="USD" /> </calrange> <calrange rangestart="11" calmethod_id="-34" cumulative="1"> <calrlookup value="0.20" setccurr="USD" /> </calrange> <calrange rangestart="21" calmethod_id="-34" cumulative="1"> <calrlookup value="0.15" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

30

d. Range based by quantity with fixed amount shipping charge Problem Quantity of the order Shipping charge (fixed amount) 0~10 $15 11~20 $20 21 and more $25 For example, if the quantity of the order is 25, the shipping charge will be $25. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="15" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-33"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-33"> <calrlookup value="25" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> e. Range based by each OrderItems quantity with fixed amount shipping charge

Problem Quantity of the OrderItem Shipping charge (fixed amount) 0~10 $15 11~20 $20 21 and more $25 For example, given an order with two OrderItems, the total quantity of this order is 25. For OrderItems, the first one is 7, the other is 18. The shipping charge for the first OrderItem is $15, and the shipping charge for the other OrderItem is $20, so the total shipping charge is $15+$20=$35.

31

Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="15" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-33"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-33"> <calrlookup value="25" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1" groupby="32"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> f. Cumulative range based by quantity with combination of fixed amount and per unit amount shipping charge

Problem Quantity of the order Shipping charge 0~10 $15 (fixed amount) 10 and more $0.50 (per unit amount) For example, given the total quantity of the order is 25, the 0~10 portion of the order will be charged a fixed amount of $15 for shipping. The shipping charge for remaining portion is 15*0.50=$7.50, the total shipping charge for the order is $22.50. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-33"

32

cumulative="1"> <calrlookup value="15" setccurr="USD" /> </calrange> <calrange cumulative="1"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> rangestart="10" calmethod_id="-34"

g. Fixed amount shipping charge spread by quantity (uniform by quantity with fixed amount shipping charge) Problem For example, $10 is the shipping charge for the store, independent of item types, weight, quantity, and so on. The $10 shipping charge is spread to the OrderItems by their quantity. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="10" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

33

Scenario 3. Setup price based shipping charges


This section describes: a. Uniform by net price with percentage shipping charge b. Range based by net price with percentage shipping charge c. Range based by net price with fixed amount shipping charge d. Range based by non-discounted price with fixed amount shipping charge e. Uniform by unit price with fixed amount shipping charge a. Uniform by net price with percentage shipping charge Problem 10% net price as shipping charge: For each order, the shipping charge amount is 10% of the net price of the order. For example, if the orders net price is $100, the shipping charge is $10 ($100*10%). Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-31" setccurr="USD"> <calrange rangestart="0" calmethod_id="-35"> <calrlookup value="10" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> Discussion In this solution, the CALSCALE.CALMETHOD_ID value is -31, representing the calculation scale and ranges are by net price. You also have CALRANGE.CALMETHOD_ID with a value of -35, which means the charge rate for this range is with a percentage value.

34

b. Range based by net price with percentage shipping charge Problem This scenario is the same as Variation A, but it is range based, different ranges have different percentage values. Net price of the order Shipping charge (percentage value) $0~$10 25% $10~$20 20% $20 and more 15% For example, if the net price of the order is $15, the shipping charge will be $3.00 ($15*20%). Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-31" setccurr="USD"> <calrange rangestart="0" calmethod_id="-35"> <calrlookup value="25" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-35"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-35"> <calrlookup value="15" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> Discussion Comparing with the solution of Variation A, there are multiple ranges and range lookup values under the calculation scale, representing different percentage rates for different net price ranges. c. Range based by net price with fixed amount shipping charge

Problem This is similar to Variation B, but it is with a fixed amount.

35

Net price of the order Shipping charge (fixed amount) $0~$10 $15 $10~$20 $20 $20 and more $25 For example, if the net price of the order is 15, the shipping charge will be $20. Solution: <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-31" setccurr="USD"> <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="15" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-33"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-33"> <calrlookup value="25" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> Discussion Comparing with Variation B, the CALRANGE.CALMETHOD_ID value is -33, which means the charge rate for this range is with a fixed amount. d. Range based by non-discounted price with fixed amount shipping charge Problem This is similar to Variation C, but it is by non-discounted price. Non-discounted price of the order Shipping charge (fixed amount) $0~$10 $15 $10~$20 $20 $20 and more $25 For example, if the non-discounted price of the order is $15, the shipping charge will be $20.

36

Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-30" setccurr="USD"> <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="15" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-33"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-33"> <calrlookup value="25" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import> Discussion Comparing with Variation C, the only difference is that the CALSCALE.CALMETHOD_ID value is -30, which means the calculation scale and ranges are by non-discounted price. e. Uniform by unit price with fixed amount shipping charge

Problem This is similar to Variations C and D, but it is by unit price. Unit price of the order Shipping charge (fixed amount) $0~$10 $15 $10~$20 $20 $20 and more $25 For example, if the unit price of the order is $15, the shipping charge will be $20. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001"

37

code="Sample calscale 1" calmethod_id="-32" setccurr="USD"> <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="15" setccurr="USD" /> </calrange> <calrange rangestart="10" calmethod_id="-33"> <calrlookup value="20" setccurr="USD" /> </calrange> <calrange rangestart="20" calmethod_id="-33"> <calrlookup value="25" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <stencalusg storeent_id="10001" calcode_id="@sample_calcode_1" /> </import>

Discussion Comparing with Variations C and D, the only difference is that the CALSCALE.CALMETHOD_ID value is -32, which means the calculation scale and ranges are by unit price. Note: For the above solutions, you can also compose combined solutions to support new price based shipping charge scenarios. For example, cumulative range based by net price with percentage shipping charge, range based by net price with combination of fixed amount and percentage shipping charge, and so on.

Scenario 4. Setup product dependent shipping charge


This section describes: a. Different products (or items) have different shipping charge rules b. Different categories have different shipping charge rules a. Different products (or items) have different shipping charge rules Problem Product or item Shipping charge rule T-shirt (catentry_id=10001) Uniform $0.50 per item Wing Chair (catenry_id=10002) Uniform $0.50 per kg All products Fixed amount $10 For example, if you buy two T-shirts and one Wing Chair (weight is 10kg), the shipping charge is

38

$16 ($0.50*2 + $0.50*10 + $10). Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> </calcode> <catencalcd catencalcd_id="@sample_catencalcd_1" store_id="10001" calcode_id="@sample_calcode_1" catentry_id="10001" />
<calscale calscale_id="@sample_calscale_2" storeent_id="10001" code="Sample calscale 2" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_2" storeent_id="10001" code="Sample calcode 2" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_2" /> </calrule> </calcode> <catencalcd store_id="10001" /> <calscale calscale_id="@sample_calscale_3" storeent_id="10001" code="Sample calscale 3" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-33"> <calrlookup value="10" setccurr="USD" /> </calrange> </calscale> catencalcd_id="@sample_catencalcd_2" calcode_id="@sample_calcode_2" catentry_id="10002"

39

<calcode

calcode_id="@sample_calcode_3"

storeent_id="10001"

code="Sample calcode 3" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_3" /> </calrule> </calcode> <catencalcd store_id="10001" </import> catencalcd_id="@sample_catencalcd_3" calcode_id="@sample_calcode_3"/>

Discussion In this solution, you have three calculation codes defined, and each calculation code is associated with different calculation rules and scales (you need to understand the charge rules from the solutions of Variations A and G of Scenario 1 and Variation A of Scenario 2). By attaching different product or items (catalog entries) to different calculation codes in the CATENCALCD table, you can make different products or items have different shipping charge rules. Note: If you attach a null catentry_id to a calculation code, this calculation code is implicitly attached to all the catalog entries (all product and items) in the catalog. b. Different categories have different shipping charge rules Problem Category Shipping charge rule Kitchenware (category_id=20001) Uniform $0.50 per item Furniture (category_id=20002) Uniform $0.50 per kg For example, if you buy one frying pan, the shipping charge is $0.50. If you buy one Lounge Chair (weight is 10kg), the shipping charge will be $5 ($0.5*10). Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-28" qtyunit_id="C62" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" />

40

</calrule> </calcode> <catgpcalcd store_id="10001" /> <calscale calscale_id="@sample_calscale_2" storeent_id="10001" code="Sample calscale 2" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_2" storeent_id="10001" code="Sample calcode 2" published="1"> <calrule> <crulescale calscale_id="@sample_calscale_2" /> </calrule> </calcode> <catgpcalcd store_id="10001" /> </import> catgpcalcd_id="@sample_catencalcd_2" calcode_id="@sample_calcode_2" catgroup_id="20002" catgpcalcd_id="@sample_catencalcd_1" calcode_id="@sample_calcode_1" catgroup_id="20001"

Discussion In this solution, you have two calculation codes, and each one is associated with a different calculation rule and scale. By attaching different categories (catalog groups) to different calculation codes in the CATGPCALCD table, you can make products in different categories have different shipping charge rules.

Scenario 5. Setup member group dependent shipping charge


This section describes the different member groups have different shipping charge rules scenario. a. Different member groups have different shipping charge rules Problem Member group Shipping charge rule Guest customer (mbrgrp_id=100001) Uniform $0.50 per kg Registered customer (mbrgrp_id=100002) Uniform $0.40 per kg VIP customer (mbrgrp_id=100003) Uniform $0.30 per kg For example, for the same goods, if you buy them as a guest user (you do not have a registered account or do not login to the store), the shipping charge for these goods is $0.50 per kg. If you are registered customer and you login to the store, the shipping charge for the same goods is $0.40

41

per kg. If you are VIP person, you get the lowest shipping charge rate at $0.30 per kg. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" code="Sample calcode 1" published="1" flags="1"> <calrule> <crulescale calscale_id="@sample_calscale_1" /> </calrule> <calcodemgp mbrgrp_id="100001" /> </calcode> <catencalcd catencalcd_id="@sample_catencalcd_1" store_id="10001" calcode_id="@sample_calcode_1"/>
<calscale calscale_id="@sample_calscale_2" storeent_id="10001" code="Sample calscale 2" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.40" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_2" storeent_id="10001" code="Sample calcode 2" published="1" flags="1"> <calrule> <crulescale calscale_id="@sample_calscale_2" /> </calrule> <calcodemgp mbrgrp_id="100002" /> </calcode> <catencalcd store_id="10001" catencalcd_id="@sample_catencalcd_2" calcode_id="@sample_calcode_2" />

<calscale calscale_id="@sample_calscale_3" storeent_id="10001" code="Sample calscale 3" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.30" setccurr="USD" /> </calrange> </calscale>

42

<calcode

calcode_id="@sample_calcode_3"

storeent_id="10001"

code="Sample calcode 3" published="1" flags="1"> <calrule> <crulescale calscale_id="@sample_calscale_3" /> </calrule> <calcodemgp mbrgrp_id="100003" /> </calcode> <catencalcd store_id="10001" </import> catencalcd_id="@sample_catencalcd_3" calcode_id="@sample_calcode_3" />

Discussion In this solution, you defined three different calculation codes, and each calculation code is applicable to all products because the calculation codes are attached by null catentry_id in the catencalcd table). Each calculation code has the CALCODE.FLAGS value of 1, which means this calculation code is only qualified to specific member groups defined in the mbrgrp elements under the calcode.

Scenario 6. Setup fulfillment option (combination of shipping mode, shipping jurisdiction and fulfillment center) dependent shipping charges
This section describes: a. Different shipping modes have different shipping charge rules b. Different shipping jurisdictions (shipping address) have different shipping charge rules c. Different fulfillment centers have different shipping charge rules a. Different shipping modes have different shipping charge rules Problem Shipping mode Shipping charge rule Regular Delivery - 5 days (shipmode_id=10001) Uniform $0.40 per kg Express Delivery -3 days (shipmode_id=10002) Uniform $0.50 per kg Overnight Delivery -1 day (shipmode_id=10003) Uniform $0.60 per kg If your order has two OrderItems, the first OrderItem (5 kg) is shipped with Regular Delivery. If you want the other OrderItem (2 kg) to be shipped with Overnight Delivery, the shipping charge for first OrderItem is $2.00, and the shipping charge for the second OrderItem is $1.20. The total shipping charge for the order is $3.20. Solution <?xml version="1.0" encoding="UTF-8"?>

43

<import

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.40" setccurr="USD" /> </calrange> </calscale> <calscale calscale_id="@sample_calscale_2" storeent_id="10001" code="Sample calscale 2" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calscale calscale_id="@sample_calscale_3" storeent_id="10001" code="Sample calscale 3" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.60" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001"

code="Sample calcode 1" published="1" > <calrule flags="1"> <shpjcrule shipmode_id="10001" /> <crulescale calscale_id="@sample_calscale_1" /> </calrule> <calrule flags="1"> <shpjcrule shipmode_id="10002" /> <crulescale calscale_id="@sample_calscale_2" /> </calrule> <calrule flags="1"> <shpjcrule shipmode_id="10003" /> <crulescale calscale_id="@sample_calscale_3" /> </calrule> </calcode> <catencalcd store_id="10001" </import> catencalcd_id="@sample_catencalcd_1" calcode_id="@sample_calcode_1"/>

Discussion In this solution, you configure one calculation code, and there are calculation rules (and corresponding calculation scales and ranges) under this calculation code. Each calculation rule has the CALRULE.FLAGS with a value of 1, which means this calculation rule is specific to some

44

fulfillment options defined in the shpjcrule table. In this case, the shpjcrule element under the calrule element defines the criteria under which the calculation rule is qualified. The attributes in the shpjcrule element are: shipmode_id: The calculation rule is only applicable to OrderItems, with the specific shipping mode configured. Null means all shipping modes are qualified. jurstgroup_id: The calculation rule is only applicable to OrderItems, with the specific shipping address in the jurisdictions of the jurisdiction group. Null means all shipping jurisdictions are qualified. ffmcenter_id: The calculation rule is only applicable to OrderItems, with the specific fulfillment center. Null means all fulfillment centers are qualified. precedence: When a shipping address falls within more than one of the specified ShippingJurisdictionGroups for the same FulfillmentCenter and ShippingMode, only the CalculationRule with the highest SHPJCRULE.PRECEDENCE value qualifies. This feature is used in the next variation of this scenario.

b. Different shipping jurisdictions (shipping address) have different shipping charge rules Problem Shipping jurisdiction Shipping charge rule United State Uniform $0.40 per kg China Uniform $0.50 per kg World Uniform $0.60 per kg For example, your order has three OrderItems (each OrderItems weight is 1 kg). The first OrderItem is shipped to United States, the second OrderItem is shipped to China, and the third OrderItem is shipped to Canada. The shipping for the first OrderItem is $0.40, the shipping charge for the second order is $0.50, and the shipping charge for the third order is $0.60, so the total shipping charge for the order is $1.50. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <jurst jurst_id="@sample_jurst_1" storeent_id="10001" code="United States" country="United States"/> <jurstgroup jurstgroup_id="@sample_jurstgroup_1" storeent_id="10001" code="United States" > <jurstgprel jurst_id="@sample_jurst_1" /> </jurstgroup>
<jurst <jurstgroup jurst_id="@sample_jurst_2" storeent_id="10001"

code="China" country="China"/> jurstgroup_id="@sample_jurstgroup_2" storeent_id="10001" code="China" > <jurstgprel jurst_id="@sample_jurst_2" />

45

</jurstgroup> <jurst code="World"/> <jurstgroup jurstgroup_id="@sample_jurstgroup_3" storeent_id="10001" code="World" > <jurstgprel jurst_id="@sample_jurst_3" /> </jurstgroup> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.40" setccurr="USD" /> </calrange> </calscale> <calscale calscale_id="@sample_calscale_2" storeent_id="10001" code="Sample calscale 2" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale> <calscale calscale_id="@sample_calscale_3" storeent_id="10001" code="Sample calscale 3" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.60" setccurr="USD" /> </calrange> </calscale> <calcode calcode_id="@sample_calcode_1" storeent_id="10001" jurst_id="@sample_jurst_3" storeent_id="10001"

code="Sample calcode 1" published="1" > <calrule flags="1"> <shpjcrule precedence="0" /> <crulescale calscale_id="@sample_calscale_1" /> </calrule> <calrule flags="1"> <shpjcrule precedence="0"/> <crulescale calscale_id="@sample_calscale_2" /> </calrule> <calrule flags="1"> <shpjcrule precedence="-1"/> <crulescale calscale_id="@sample_calscale_3" /> jurstgroup_id="@sample_jurstgroup_3" jurstgroup_id="@sample_jurstgroup_2" jurstgroup_id="@sample_jurstgroup_1"

46

</calrule> </calcode> store_id="10001" </import> <catencalcd catencalcd_id="@sample_catencalcd_1" calcode_id="@sample_calcode_1"/>

Discussion In this solution, you defined three jurisdictions and jurisdiction groups. Similar to the previous variation, you also defined one calculation code for all products, and three different calculation rules for different shipping charge rates. Each calculation rule is only qualified for the OrderItems with fulfillment options defined in the shpjcrule element. In this case, each calculation rule matches to one jurisdiction. Given an OrderItem with a shipping address in the jurisdictions other than United States and China, the World jurisdictions will always be qualified. Therefore, the corresponding charge rule will always be applicable for these shipping jurisdictions. For the OrderItem with a shipping address in the United States or China jurisdictions, the World jurisdiction will also be qualified. However, because its precedence is -1 (smaller than 0), the rule corresponding to World jurisdiction will not be used. c. Different fulfillment centers have different shipping charge rules

Problem Fulfillment center Shipping charge rule North America storehouse (ffmcenter_id=10001) Uniform $0.40 per kg Asia Pacific storehouse (ffmcenter_id=10002) Uniform $0.50 per kg For example, your order has two OrderItems. One OrderItem is shipped from the North America storehouse fulfillment center, the other is shipped from Asia Pacific storehouse fulfillment center. The shipping for the first OrderItem will be $0.40, and the shipping charge for the second OrderItem is $0.50, the total shipping charge for the order is $0.90. Solution <?xml version="1.0" encoding="UTF-8"?> <import xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shipping.xsd"> <calscale calscale_id="@sample_calscale_1" storeent_id="10001" code="Sample calscale 1" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.40" setccurr="USD" /> </calrange> </calscale> <calscale calscale_id="@sample_calscale_2" storeent_id="10001" code="Sample calscale 2" calmethod_id="-29" qtyunit_id="KGM" > <calrange rangestart="0" calmethod_id="-34"> <calrlookup value="0.50" setccurr="USD" /> </calrange> </calscale>

47

<calcode

calcode_id="@sample_calcode_1"

storeent_id="10001"

code="Sample calcode 1" published="1" > <calrule flags="1"> <shpjcrule ffmcenter_id="10001" /> <crulescale calscale_id="@sample_calscale_1" /> </calrule> <calrule flags="1"> <shpjcrule ffmcenter_id="10002" /> <crulescale calscale_id="@sample_calscale_2" /> </calrule> </calcode> <catencalcd store_id="10001" </import> catencalcd_id="@sample_catencalcd_1" calcode_id="@sample_calcode_1"/>

Discussion This solution is similar to the solution of Variation A. Define two calculation rules under the calculation code, and each rule has its fulfillment option criteria defined in the shpjcrule element. In this case, the fulfillment options only contain fulfillment center information. The corresponding calculation rule is qualified for the OrderItems with the specified fulfillment center, regardless of the shipping mode and shipping address. Note: For the above solutions, you can define any combined fulfillment options for specific shipping charge rules. For example, OrderItems shipped with Regular Delivery shipping mode and shipped to New York will be charged $0.50 per kg.

Conclusion
This article introduced the following shipping configuration topics: Basic concept and overview of the WebSphere Commerce calculation framework Shipping charge scenarios supported by the calculation framework by default How to manage the shipping configuration with the shipping notebook in WebSphere Commerce Accelerator How to manage the shipping configuration bypassing the shipping notebook Typical shipping charge scenarios and corresponding sample data The six shipping charge scenarios are common in real businesses, and each scenario has multiple variations from simple to complex. You can easily reuse these samples data by following the stepby-step instructions, and create new variations according to the explanation in the discussion portion for the variations.

48

Resources
WebSphere Commerce Information Center V6.0 WebSphere Commerce Information Center: Setting up shipping WebSphere Commerce Information Center: Calculation framework WebSphere Commerce support site: Configuring fixed amount shipping charges based on weight ranges WebSphere Commerce support site: Setting up multiple shipping charges based on total price and jurisdiction

About the authors


Jiu Zheng Han is a Software Developer at the IBM China Lab, Beijing. He is currently working in WebSphere Commerce development and level 3 support as a component owner of the order subsystem and calculation framework. Alex Shum is a Software Developer at the IBM Toronto Lab, Canada. He is currently working in WebSphere Commerce solution development as the subject matter expert for the order and payment component. Dorothy Wu is a Content Editor at the IBM Silicon Valley Lab in San Jose, California. She works on the developerWorks WebSphere Commerce zone and developerWorks WebSphere community features, such as Meet the experts.

Trademarks
DB2, IBM, and WebSphere are trademarks or registered trademarks of IBM Corporation in the United States, other countries, or both. Windows and Windows NT are registered trademarks of Microsoft Corporation in the United States, other countries, or both. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. Other company, product, and service names may be trademarks or service marks of others. IBM copyright and trademark information: http://www.ibm.com/legal/copytrade.phtml

49

You might also like