Creating shipping assets using an XML file

Create your shipping assets in the format of XML files that can be loaded into the database using the loading utilities. If you are creating a globalized store, you may want to create separate XML files for each locale your store supports. The locale-specific file should specify all description information, so it can be easily translated.

About this task

The starter stores, from which many of the examples in these tasks are taken, use one shipping.xml file for all information that does not need to be translated, and another shipping.xml file for each locale the store supports, for the information that needs to be translated. The locale-specific files contain all the description information, so it can be easily translated.

To create shipping assets for your store using an XML file:

Procedure

  1. Create an XML file that follows the wcs.dtd file. The DTD file is located in the following directory:
    • WC_installdir/schema/xml
    • WebSphere Commerce Developer workspace_dir/wc/xml/sar/
  2. Define the jurisdictions and jurisdiction group to which you are shipping goods and services. All jurisdictions must belong to a jurisdiction group.
    1. Using the following example as your guide, define a jurisdiction group in your XML file in the JURSTGROUPtable:
      
      <jurstgroup
      jurstgroup_id="@jurstgroup_id_1"
      description="Jurisdiction Group1
      for Shipping"subclass="1"
      storeent_id="@storeent_id_1"
      code="World"
      markfordelete="0"
      />
      
    2. Using the following example as your guide, define a jurisdiction in your XML file in the JURST table.
      
      <jurst
      jurst_id="@jurst_id_1" 
      storeent_id="@storeent_id_1"
      code="World"
      subclass="1"
      markfordelete="0"
      />
      
    3. Using the following example as your guide, associate the jurisdiction you created in step b with the jurisdiction group you defined in step a, by adding information to the JURSTGPREL table.
      
      <jurstgprel
      jurst_id="@jurst_id_1"
      jurstgroup_id="@jurstgroup_id_1"
      subclass="1"/>
      
    4. Repeat steps a through c for all jurisdictions and jurisdiction groups your store supports.
  3. Define the shipping modes your store will use.
    1. Using the following example as your guide, define a shipping mode in your XML file for the SHIPMODE table:
      
      <shipmode
      shipmode_id="@shipmode_id_1"
      field1
      storeent_id="@storeent_id_1"
      code="Ground 1 week"
      carrier="XYZ Carrier"
      markfordelete="0"
      />
      
    2. Using the following example as your guide, add information about the shipping mode to the SHPMODEDSC table. If you are creating a multicultural store, you should include this information in a locale-specific XML file:
      
      <shpmodedsc
      description="International mail"
      field1="USD$5.00 per order plus USD$1.00 for each item"
      field2="5 business days"
      shipmode_id="@shipmode_id_1"
      language_id="&en_US;"/>
      
    3. Repeat steps a and b for all shipping modes in your store.
  4. Define the calculation codes to be used by your store.
    1. Using the following examples as your guide, define the calculation code in your XML file for the CALCODE table.
      
      <calcode calcode_id="@calcode_id_1" 
      code="shipping Code 1- per/order"
      calusage_id="-2" 
      storeent_id="@storeent_id_1"
      groupby="0" 
      published="1" 
      sequence="+0.00E+000" calmethod_id="-23"
      calmethod_id_app="-24"
      calmethod_id_qfy="-22"flags="0"
      />
      
    2. Using the following example as your guide, add the calculation code description information in your XML file for the CALCODEDSC table. If you are creating a globalized store, you should include this information in a locale-specific XML file.
      
      <calcodedsc
              calcode_id="@calcode_id_3"
              description="5.00USD per order"
              language_id="&en_US"        
              longdescription= "This shipping calculation code charges 5.00USD per order." />
      
    3. Repeat steps a and b for each calculation code used in your store.
  5. Define the calculation rules for your store.
    1. Using the following example as your guide, set up the calculation rule in your XML file for the CALRULE table:
      
      <calrule
      calrule_id="@calrule_id_1"
      calcode_id="@calcode_id_1"
      startdate="1900-01-01 00:00:00.000000"
      enddate="2100-01-01 00:00:00.000000"
      sequence="+1.00000000000000E+000"
      combination="2"
      calmethod_id="-27"
      calmethod_id_qfy="-26"
      flags="1"
      identifier="1"/>
      
    2. Repeat step a for each calculation rule used in your store. Note that each calculation code may have several calculation rules. For example, calcode_id="@calcode_id_1" may be associated with several calrule_ids.
  6. Define calculation scales for your store.

    A calculation scale is the set of ranges that will apply to the calculation. For example, for shipping costs you may have a set of weight ranges that each correspond to a particular cost. That is, a product that weighs between 0 to 5 kg might cost $10.00 to ship. And a product weighing 5 to 10 kg might cost $15.00 to ship. These ranges create a scale.

    1. Using the following example as your guide, set up the calculation scale in your XML file for the CALSCALE table:
      
      <calscale calscale_id="@calscale_id_1"
      code="Scale Code 1 per order USD"storeent_id="@storeent_id_1"
      calusage_id="-2"setccurr="USD"
      calmethod_id="-28"/>
      
    2. Repeat step a for each calculation scale used in your store.
  7. Define calculation ranges for the calculation scales.
    1. Using the following example as your guide, set up the calculation range in your XML file for the CALRANGE table.
      
      <calrangecalrange_id="@calrange_id_1"
      calscale_id="@calscale_id_1"calmethod_id="-33"
      rangestart="0.00000"cumulative="0"/>
      
    2. Repeat step a for each calculation range associated with the calculation scale used in your store.
  8. Define the calculation lookup values for the calculation scales. The calculation lookup values are the values associated with the calculation scale. For example, a calculation scale includes the following weight ranges and associated prices for shipping:
    • 0 to 5 kg costs $10.00
    • 5 to 10 kg costs $15.00

    The lookup values are $10.00 and $15.00.

    1. Using the following examples as your guide, set up the calculation lookup values in your XML file for the CALRLOOKUP table. If you are creating a multicultural store, you should include this information in a locale-specific XML file, that is, one file per locale that your store supports. For example, if your store ships to customers in the United States and Japan, you should add the US dollar lookup values in one XML file, and the Yen lookup values in another XML file.
      
      <calrlookup
      calrlookup_id="@calrlookup_id_1"
      setccurr="USD"
      calrange_id="@calrange_id_1"
      value="5.00"/>
      
    2. Repeat step a for each lookup value associated with the calculation scale used in your store.
  9. Associate the calculation rule and calculation scale
    1. Using the following examples as your guide, associate the calculate scale with the calculation rule in your XML file for the CRULESCALE table.
      
      <crulescale
       calrule_id="@calrule_id_1"
       calscale_id="@calscale_id_1" />
      
    2. Repeat step a for each calculation scale and rule association.