Filtering shipping modes

Sometimes a shipping mode might not be applicable to all products. If you choose not to associate a shipping mode with a product, then no shipping charge is applied to that product. You can filter applicable shipping modes by customizing according to the following instructions.

Procedure

This procedure describes how to customize the storefront shopping flow. It does not describe how to customize order creation in the WebSphere Commerce Accelerator.
  1. Refer to the com.ibm.commerce.fulfillment.beans.OrderShippingModeListDataBean data bean. This data bean lists the shipping modes available to an order. The following table shows the input parameters.
    Name Description
    order The OrderDataBean
    calculateShippingCharge If this parameter is set to true, this data bean filters the shipping modes that are not applicable and estimate the shipping charge of each shipping mode. If this parameter is set to false, this data bean returns the intersection of the shipping modes that are allowed for each order item.
    CalculateShippingAdjustment This parameter takes effect only if the calculateShippingCharge parameter is set to true. If this parameter is set to true, this data bean adds the shipping adjustment of the shipping promotion result while it calculates the shipping charge.
    resolveFulfillmentCenter This parameter takes effect only if the calculateShippingCharge parameter is set to true. When this parameter is set to true, this data bean resolves the fulfillment centers of the items in the order before it calculates the shipping charge. This behavior occurs because some shipping charge configurations are related to the fulfillment center. Typically, this flag can be set to true since shipping configuration almost always relates to the fulfillment center.
    checkAppliedItems

    By default, this parameter is set to true. In previous releases, STENCALUSG.USAGEFLAGS must be set to 3 to filter shipping modes.

  2. For any shipping mode returned by the OrderShippingModeListDataBean, a shipping charge can be calculated.
  3. Change the store flow or function to allow a single shipping address and a single shipping method:
    • Change the store function with the Store Management tool in Management Center:
      1. Open the Store Management tool.
      2. In the explorer view filter, click Stores.
      3. From the list of available stores, right-click the store that includes the shipping methods that you want to change. Click Open.
      4. Click the Checkout tab.
      5. Clear the Multiple shipments check box.
      6. Click Save.

    The OrderShippingModeListDataBean can support only shipping with one address and one shipping method for an order.

  4. Apply the OrderShippingModeListDataBean in the JSP file.
    For example, change the AdvancedOrderForm.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"/>
    <c:set target="${orderShippingModeList}"
    property="calculateShippingAdjustment" value="true"/>
    </wcbase:useBean>
    //the orderShippingModeList contains all the filtered shipping
    modes
    <table>
    <tr>
    <th>ShipMode ID</th>
    <th>Shipping Mode</th>
    <th>Shipping Charge</th>
    </tr>
    <c:forEach items="${orderShippingModeList.shippingModes}"
    var="shippingMode" varStatus="status">
    <tr>
     <td><c:out
    value="${shippingMode.shippingModeId}"/></td>
    <td><c:out
    value="${shippingMode.description.description}"/></td>
    <td><c:out
    value="${orderShippingModeList.shippingCharges[status.index]}"/></td>
    </tr> 
    </c:forEach>
    </table>
    
    For the Aurora store, change the SingleShipmentShippingMethodDetails.jsp file. Customize the JSP file for selecting shipping mode as shown in the following code snippet:
    <select class="drop_down_shipping" name="singleShipmentShippingMode"
        id="singleShipmentShippingMode"  onchange="JavaScript:setCurrentId(this.id);  CheckoutHelperJS.updateShipModeForAllItems(this)">    
    <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"/>    
    <c:set target="${orderShippingModeList}" property="calculateShippingAdjustment" value="true"/>   
    </wcbase:useBean>
    <c:forEach var="shippingMode" items="${orderShippingModeList.shippingModes}">     
    <c:if test="${shippingMode.code != 'PickupInStore' &&  (!b2bStore || (b2bStore && shipModeMap[shippingMode.shippingModeId] == param.recordSetTotal))}">     
    
    <%-- Show all the shipping options available except for pickUp in Store --%>
    <%-- This block is to select the shipMode Id in the drop down  box.. if this shipMode is selected then set selected = true --%>     
    <option shipModeCode="${shippingMode.code}"
    <c:if test="${(shippingMode.shippingModeId eq blockShipModeId)}">      
    <c:set var="selectedShippingMode" value="${shippingMode.shippingModeId}"/>selected="selected"</c:if>      
    value="<c:out value='${shippingMode.shippingModeId}'/>">      
    <c:choose>       
    <c:when test="${!empty shippingMode.description.description}">        
    <c:out value="${shippingMode.description.description}"/>       
    </c:when>
    <c:otherwise>        
    <c:out value="${shippingMode.code}"/>       
    </c:otherwise>
    </c:choose>     
    </option>    
    </c:if>       
    </c:forEach>  
    </select>