From the developer:
The databean OrderShippingModeListDataBean can be used to get the estimated shipping charge for each shipping mode.
This databean is mainly used to filter the shipping modes with no shipping charge, it can also get the shipping charge for each shipping method.
The OrderShippingModeListDataBean can only support shipping with one address and one shipping method for an order, cause it suppose all order items in the order are shipped to the same address using one shipping method, then try to calculate the shipping charge for each shipping method.
Steps to apply it:
1. Apply the latest OrderShippingModeListDataBean class. This data bean lists the shipping modes available to a given order. The following table shows the input parameters.
Name Description
order: The OrderDataBean
calculateShippingCharge: True if the shipping charges are to becalculated. (If no shipping charge can be resolved, this shipping method is filtered, the shipping mtehod with which shipping charge is Zero is allowed.)
Set the parameter to true.
resolveFulfillmentCenter: True if fulfillment center is to be resolved. (If no fulfillment center can be resolved for an item, there will be no shipping charge calculated for it.)Set the parameter to true.
2. Update the database to configure the calculation framework to throw an exception if the CalculationUsage does not calculate a value for the OrderItem.
UPDATE STENCALUSG SET USAGEFLAGS=3 WHERE STOREENT_ID IN (-1, storeId) AND CALUSAGE_ID=-2
Where:
storeId
The store ID of the target store.
Behavior
OrderShippingModeListDataBean retrieves shipping modes allowed by the contracts.
resolveFulfillmentCenter is set to true, OrderShippingModeListDataBean tries to allocate the fulfillment center. If any of the order items are not allocated, no shipping mode can be selected for this order.
Set calculateShippingCharge to be true, OrderShippingModeListDataBean tries to calculate the temp shipping charge for each shipping mode, as STENCALUSG.USAGEFLAGS is set to be 3, if any item's shipping charge is not calculated with a shipping mode, this shipping mode can not not be selected for this order.
For any shipping mode returned by the OrderShippingModeListDataBean, a shipping charge can be calculated.
3. Change the store flow to allow a single shipping address and a single shipping method.
a. Open WebSphere Commerce Accelerator.
b. Select Store > Change Flow.
c. Select Checkout.
d. Deselect the Allow multiple shipping addresses check box.
e. Select Single shipping methods.
f. Click Apply. This update can take some time.
The OrderShippingModeListDataBean can only support shipping with one address and one shipping method for an order.
4. Apply the OrderShippingModeListDataBean in the JSP file. For example, change the SingleShippingMethodDisplay.jsp file.
Customize the JSP file for selecting shipping mode as shown in the following code snippet:
<wcbase:useBean id="orderShippingModeList" classname="com.ibm.commerce.fulfillment.beans.OrderShippingModeListDataBean">
<c:set target="${orderShippingModeList}" property="order" value="${orderBean}"/>
<c:set target="${orderShippingModeList}" property="calculateShippingCharge" value="true"/>
<c:set target="${orderShippingModeList}" property="resolveFulfillmentCenter" value="true"/>
</wcbase:useBean>
//the orderShippingModeList contains all the filtered shipping modes
<table>
<tr>
<th>Shipping Mode</th>
<th>Shipping Charge</th>
</tr>
<c:forEach items="${orderShippingModeList.shippingModes}" var="shippingMode" varStatus="status">
<tr>
<td><c:out value="${shippingMode.description.description}"/></td>
<td><c:out value="${orderShippingModeList.shippingCharges[status.index]}"/></td>
</tr>
</c:forEach>
</table>
the url of this doc on the info center
http://ecdfp.torolab.ibm.com/darwyn/com.ibm.commerce.developer.doc/tasks/tshcustomizeshipping.htm
For the free shipping promotion, the current code doesn't support it, we will try to do some change to support this feature.