Develop > Persistence layer > Data assets > Create shipping assets
Create shipping assets using an XML file
Create the 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 the store supports. The locale-specific file should specify all description information, so it can be translated.
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 translated.
To create shipping assets for the store using an XML file:
Procedure
- Create an XML file that follows the wcs.dtd file. The DTD file is located...
- WC_INSTALL/schema/xml
- workspace_dir/wc/xml/sar/
- Define the jurisdictions and jurisdiction group to which you are shipping goods and services. All jurisdictions must belong to a jurisdiction group.
- Use the following example as the guide, define a jurisdiction group in the XML file in the JURSTGROUP table:
<jurstgroup jurstgroup_id="@jurstgroup_id_1" description="Jurisdiction Group1 for Shipping"subclass="1" storeent_id="@storeent_id_1" code="World" markfordelete="0" />
- Use the following example as the guide, define a jurisdiction in the XML file in the JURST table.
<jurst jurst_id="@jurst_id_1" storeent_id="@storeent_id_1" code="World" subclass="1" markfordelete="0" />
- Use the following example as the 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"/>
- Repeat steps a through c for all jurisdictions and jurisdiction groups the store supports.
- Define the shipping modes the store will use.
- Use the following example as the guide, define a shipping mode in the 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" />
- Use the following example as the 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;"/>
- Repeat steps a and b for all shipping modes in your store.
- Define the calculation codes to be used by the store.
- Use the following examples as the guide, define the calculation code in the 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" />
- Use the following example as the guide, add the calculation code description information in the 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." />
- Repeat steps a and b for each calculation code used in the store.
- Define the calculation rules for the store.
- Use the following example as the guide, set up the calculation rule in the 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"/>
- 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.
- Define calculation scales for the 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.
- Use the following example as the guide, set up the calculation scale in the 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"/>
- Repeat step a for each calculation scale used in your store.
- Define calculation ranges for the calculation scales.
- Use the following example as the guide, set up the calculation range in the XML file for the CALRANGE table.
<calrangecalrange_id="@calrange_id_1" calscale_id="@calscale_id_1"calmethod_id="-33" rangestart="0.00000"cumulative="0"/>
- Repeat step a for each calculation range associated with the calculation scale used in the store.
- 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.
- Use the following examples as the guide, set up the calculation lookup values in the 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 the store supports. For example, if the 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"/>
- Repeat step a for each lookup value associated with the calculation scale used in the store.
- Associate the calculation rule and calculation scale
- Use the following examples as the guide, associate the calculate scale with the calculation rule in the XML file for the CRULESCALE table.
<crulescale calrule_id="@calrule_id_1" calscale_id="@calscale_id_1" />
- Repeat step a for each calculation scale and rule association.
Related reference