|
|
Shipping Services
In Order services, Shipping Services record the shipping information related to a customer's order and calculate shipping costs. This topic describes the Shipping Services in detail, and provides information about how you can customize them to meet your specific needs.
This topic includes the following sections:
JavaServer Pages
Shipping Services in Order services consist of three JavaServer Pages (JSPs) that you can use as is, or customize to your own liking. This section describes each of these pages in detail.
Note: For a description of the complete set of JSPs used in the WebLogic PortalWeb application and a listing of their locations in the directory structure, see the E-Commerce JSP Template Summary.
shipping.jsp Template
The shipping.jsp template (shown in Figure 4-1) allows the customer to select and input shipping details for the order. Shipping details include the shipping method (such as standard, second day air, and so on), shipping preference (all at once or as items become available) and any special shipping instructions the customer may want to specify.
If the customer is satisfied with the shipping details for the order, the customer can click the Continue button to continue to the next part of the checkout process. If the customer had forgotten something or wanted to do something else to their order, the customer can click the Back button instead.
Sample Browser View
Figure 4-1 shows an annotated version of the shipping.jsp template. A discription of the annotated regions follow the figure.
Figure 4-1 Annotated shipping.jsp Template
The numbers in the following list refer to the numbered regions in the figure:
Note: For information on other elements in the shipping.jsp template, see Common JSP Template Elements.
Location in the WebLogic Portal Directory Structure
You can find the shipping.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed WebLogic Portal:
%PORTAL_HOME%applications\wlcsApp\wlcs\commerce\order\
shipping.jsp (Windows)
$PORTAL_HOME/applications/wlcsApp/wlcs/commerce/order/
shipping.jsp (UNIX)
Tag Library Imports
The shipping.jsp template uses WebLogic Server and Pipeline JSP tags. Therefore, the template includes the following JSP tag libraries:
<%@ taglib uri="weblogic.tld" prefix="wl" %>
<%@ taglib uri="webflow.tld" prefix="webflow" %>
Note: For more information on the WebLogic Server JSP tags, see "JSP Tag Reference" in the Guide to Building Personalized Applications. For more information about the Pipeline JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.
These files reside in the lib directory within PORTAL_HOME.
Java Package Imports
The shipping.jsp template uses Java classes in the following packages and therefore includes these import statements:
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="examples.wlcs.sampleapp.shipping.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>
<%@ page import="com.beasys.commerce.webflow.PipelineSessionConstants" %>
Location in Default Webflow
The shipping.jsp template follows the page where the customer manages their shopping cart (shoppingcart.jsp), or any product catalog page where the customer clicks the View Cart button. The next page allows the customer to select a shipping address (selectaddress.jsp).
This template is in the sampleapp_order namespace.
Notes: If the customer has not yet logged into the site and clicks the Check Out button on the shopping cart page, the customer will be prompted to log in at the login.jsp template prior to loading the shipping.jsp. For more information about the login.jsp template, see the Guide to Registering Customers and Managing Customer Services.
For more information about the default Webflow, see Overview of Managing Purchases and Processing Orders.
Events
The shipping.jsp template presents a customer with two buttons, each of which is considered an event. Each event triggers a particular response in the default Webflow that allows customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 4-1 provides information about these events and the business logic they invoke.
Event |
Webflow Response(s) |
---|---|
button.back |
No business logic required. Loads shoppingcart.jsp. |
button.continue |
ValidateShippingInfoIP. |
Dynamic Data Display
One purpose of the shipping.jsp template is to display information about the possible shipping methods for the order. This is accomplished on shipping.jsp using a combination of WebLogic Server JSP tags, Pipeline JSP tags and accessor methods/attributes.
First, the getProperty JSP tag retrieves the SHIPPING_METHOD_LIST attribute from the Pipeline session. Table 4-2 provides more detailed information about this attribute.
Listing 4-1 illustrates how this attribute is retrieved from the Pipeline session.
Listing 4-1 Retrieving the Shipping Method Attribute
<webflow:getProperty id="shippingMethodListObject" property="<%=PipelineSessionConstants.SHIPPING_METHOD_LIST%>" type="java.util.List" scope="session" namespace="sampleapp_main" />
Note: For more information on the getProperty JSP tag, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.
The data stored within this Pipeline session attribute is then accessed by using accessor methods/attributes within Java scriptlets. Table 4-3 provides more detailed information about these methods for ShippingMethodValue.
Method/Attribute |
Description |
---|---|
description |
A description of the shipping method. |
identifier |
Key in the database for the shipping method. |
Listing 4-2 illustrates how these accessor methods/attributes are used within Java scriptlets.
Listing 4-2 Using Accessor Methods Within shipping.jsp Java Scriptlets
<wl:repeat set="<%=shippingMethodList%>" id="shippingMethodValue" type="ShippingMethodValue" count="100">
<tr>
<td width="1%" valign="top">
<!-- put up a button for each of item -->
<%
if((previousShippingMethodValue != null && shippingMethodValue.identifier.equals(previousShippingMethodValue.identifier)) ||
(previousShippingMethodValue == null && defaultShippingMethod == true) )
{
shippingMethodCheckedStatus = "CHECKED";
defaultShippingMethod = false;
}
else
{
shippingMethodCheckedStatus = "";
}
%>
<input <%=shippingMethodCheckedStatus%> type="radio" name="<%=HttpRequestConstants.SHIPPING_METHOD%>" value="<%=shippingMethodValue.identifier%>">
</td>
<td valign="top">
<div class="tabletext"><%=shippingMethodValue.description%></div>
</td>
</tr>
</wl:repeat>
Note: For more information on the WebLogic Server JSP tags, see "JSP Tag Reference" in the Guide to Building Personalized Applications.
Form Field Specification
Other purposes of the shipping.jsp template are to collect information from the customer and to pass hidden information to the Webflow. The form fields used in the shipping.jsp template, and a description for each of these form fields, are listed in Table 4-4.
Note: Parameters that are literals in the JSP code are shown in quotes, while non-literals will require JSP scriptlet syntax (such as
<%= HttpRequestConstants.SPLITTING_PREFERENCE_CODE %>) for use in the JSP.
selectaddress.jsp Template
The selectaddress.jsp template (shown in Figure 4-2) displays a list of shipping addresses that have previously been associated with the customer. If the customer clicks the Use button associated with a particular address, that address will be used as the shipping address and the customer will continue to the next part of the checkout process.
If the customer wants to delete an address that is shown, the customer can click the Delete button associated with that address. To add a new shipping address, the customer can click the Add Address button. To go back to the previous page, the customer can click the Back button instead.
Sample Browser View
Figure 4-2 shows an annotated version of the selectaddress.jsp template. The Select Shipping Address region contains dynamically displayed data of the customer's saved shipping addresses. This is accomplished using a combination of WebLogic Server and WebLogic Portal JSP tags that obtain and display the addresses. Posts to the form can indicate use of a listed address or deletion of a listed address.
Notes: The customer can also initiate entry of a new shipping address from the selectaddress.jsp template. For more information about the addaddress.jsp template, see addaddress.jsp Template.
For information on other elements in the selectaddress.jsp template, see Common JSP Template Elements.
Figure 4-2 Annotated selectaddress.jsp Template
Location in the WebLogic Portal Directory Structure You can find the selectaddress.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed WebLogic Personalization Server: %PORTAL_HOME%\applications\wlcsApp\wlcs\commerce\order\ Tag Library Imports The selectaddress.jsp template uses existing WebLogic Server and the WebLogic Portal's User Management and Personalization JSP tags. It also uses Pipeline JSP tags. Therefore, the template includes the following JSP tag libraries: Note: For more information on the WebLogic Server JSP tags or the WebLogic Portal JSP tags, see JSP Tag Reference" in the Guide to Building Personalized Applications. For more information about the Pipeline JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline. These files reside in the lib directory within PORTAL_HOME. Java Package Imports The selectaddress.jsp template uses Java classes in the following packages and therefore includes these import statements: Location in Default Webflow The page prior to the selectaddress.jsp template in the default Webflow is either the shipping details page (shipping.jsp) or the page where the customer enters a new shipping address (addaddress.jsp). If the customer deletes an existing shipping address, the selectaddress.jsp is reloaded after the appropriate input processor and/or Pipeline has executed. If the customer is satisfied with selecting an address from the list of choices, they proceed to the payment information page (payment.jsp). This template is in the sampleapp_order namespace. Note: For more information about the default Webflow, see Overview of Managing Purchases and Processing Orders. Events The selectaddress.jsp template presents a customer with several buttons, each of which is considered an event. These events trigger a particular response in the default Webflow that allows customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 4-5 provides information about these events and the business logic they invoke. Table 4-6 briefly describes each of the Pipelines from Table 4-5. For more information about individual Pipeline components, see Pipeline Components. Dynamic Data Display One purpose of the selectaddress.jsp template is to display the shipping addresses a customer previously entered. This is accomplished on selectaddress.jsp using two of the WebLogic Portal's User Management JSP tags. First, the getProfile JSP tag is used to set the customer profile (context) for which the shipping addresses should be retrieved, as shown in Listing 4-3. Listing 4-3 Setting the Customer Context Next, the getProperty JSP tag is used to retrieve a cached copy of the possible shipping addresses for the customer from the database, as shown in Listing 4-4. Listing 4-4 Retrieving the ShippingAddressMap for the Customer You can now iterate through the shipping addresses contained within the shippingAddressMap, as shown in Listing 4-5. Listing 4-5 Iterating Through the Shipping Addresses Note: For more information on the WebLogic Portal's JSP tags, see "JSP Tag Reference" in the Guide to Building Personalized Applications. Lastly, the data contained within shippingAddress is accessed by using accessor methods/attributes within Java scriptlets. Table 4-7 provides more detailed information about these methods for Address. Listing 4-6 illustrates how these accessor methods/attributes are used within Java scriptlets. Listing 4-6 Using Accessor Methods Within selectaddress.jsp Java Scriptlets Form Field Specification The selectaddress.jsp template does not make use of any form fields. addaddress.jsp Template The addaddress.jsp template (shown in Figure 4-3) collects information about a new shipping address from the customer. This information includes two lines of a street address (one required), a city, a state, a zip code, and a country (all required). When the customer clicks the Save button, the shipping address entered on this page is added to the list of addresses from which customers can select for this and future orders (selectaddress.jsp). Otherwise, the customer can click the Back button to return to the previous page. Sample Browser View Figure 4-3 shows an annotated version of the addaddress.jsp template. The Add Shipping Address region provides the customer with a series of form fields for entering a new shipping address. Required fields are indicated by an asterisk (*). This region utilizes the states.jsp and countries.jsp template files. The "include" calls in addaddress.jsp are: Note: For information on other elements in the addaddress.jsp template, see Common JSP Template Elements. Figure 4-3 Annotated addaddress.jsp Template
selectaddress.jsp (Windows)
$PORTAL_HOME/applications/wlcsApp/wlcs/commerce/order/
selectaddress.jsp (UNIX)<%@ taglib uri="webflow.tld" prefix="webflow" %>
<%@ taglib uri="um.tld" prefix="um" %>
<%@ taglib uri="es.tld" prefix="es" %><%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="examples.wlcs.sampleapp.shipping.*" %>
<%@ page import="examples.wlcs.sampleapp.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>
<um:getProfile
profileKey="<%=request.getRemoteUser()%>"
profileType="WLCS_Customer" /><um:getProperty propertySet="CustomerProperties" propertyName="shippingAddressMap" id="shippingAddressMap" />
<%
Iterator iterator =((Map)shippingAddressMap).keySet().iterator();
while(iterator.hasNext())
{
String addressKey = (String)iterator.next();
Address shippingAddress = (Address)((Map)shippingAddressMap).get(addressKey);
%>
<%
Iterator iterator =((Map)shippingAddressMap).keySet().iterator();
while(iterator.hasNext())
{
String addressKey = (String)iterator.next();
Address shippingAddress = (Address)((Map)shippingAddressMap).get(addressKey);
%>
<table width="90%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td align="left" valign="top" width="40%" nowrap>
<p><%= shippingAddress.getStreet1() %><br>
<% if( shippingAddress.getStreet2().length() != 0) {%>
<%= shippingAddress.getStreet2() %><br>
<% } %>
<%= shippingAddress.getCity() %><br>
<%= shippingAddress.getState() %> <%= shippingAddress.getPostalCode() %><br>
<%= shippingAddress.getCountry() %>
</td>
<td align="left" valign="top" width="5%" >
<%
String extraParams = HttpRequestConstants.ADDRESS_KEY + "=" + addressKey;
%>
<div class="commentary">
<a href="<webflow:createWebflowURL event="button.deleteShippingAddress" httpsInd="calculate" namespace="sampleapp_order" extraParams="<%= extraParams %>" />"><img src="<webflow:createResourceURL resource="/commerce/images/btn_delete.gif" />" border="0"></a>
</div>
</td>
<td align="left" valign="top" width="5%" >
<div class="commentary">
<a href="<webflow:createWebflowURL event="button.useShippingAddress" httpsInd="calculate" namespace="sampleapp_order" extraParams="<%= extraParams %>" />"><img src="<webflow:createResourceURL resource="/commerce/images/btn_use.gif" />" border="0"></a>
</div></td>
</tr>
<tr>
<td colspan="3">
<hr size="1">
</td>
</tr>
</table>
<%
}
%>
<%@ include file="/commerce/includes/countries.inc" %>
<%@ include file="/commerce/includes/footer.inc" %>
<%@ include file="/commerce/includes/stylesheet.inc" %>
<%@ include file="/commerce/includes/admin.inc" %>
<%@ include file="/commerce/includes/header.inc" %>
<%@ include file="/commerce/includes/leftside.inc" %>
<%@ include file="/commerce/includes/states.inc" %>
Location in the WebLogic Portal Directory Structure You can find the addaddress.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed WebLogic Portal: %PORTAL_HOME%\applications\wlcsApp\wlcs\commerce\order\ Tag Library Imports The addaddress.jsp template uses Webflow and Pipeline JSP tags. Therefore, the template includes the following JSP tag libraries: Note: For more information on the Webflow and Pipeline JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline. These files reside in the lib directory within PORTAL_HOME. Java Package Imports The addaddress.jsp template uses Java classes in the following packages and therefore includes these import statements: Location in Default Webflow The addaddress.jsp template follows the page where the customer selects from a list of possible shipping addresses (selectaddress.jsp). Once the customer saves the new address, the customer is returned to the selectaddress.jsp template. Note: For more information about the default Webflow, see Overview of Managing Purchases and Processing Orders. Events The addaddress.jsp template presents a customer with two buttons, each of which is considered an event. These events trigger a particular response in the default Webflow that allows customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 4-8 provides information about these events and the business logic they invoke. Table 4-9 briefly describes each of the Pipelines from Table 4-8. For more information about individual Pipeline components, see Pipeline Components. Dynamic Data Display No dynamic data is presented on the addaddress.jsp template. However, the addaddress.jsp template does make use of code similar to that found in the newaddresstemplate.jsp template. Namely, it uses the same code to indicate when customers enter incorrect input or fail to provide information for a required field. For more information about the newaddresstemplate.jsp template, see "About the Included newaddresstemplate.jsp Template" in the Guide to Registering Customers and Managing Customer Services. Form Field Specification The purpose of the addaddress.jsp template is to allow customers to enter a new shipping address using various HTML form fields. It is also used to pass needed information to the Webflow. The form fields used in the addaddress.jsp template, and a description for each of these form fields are listed in Table 4-10. Note: Parameters that are literals in the JSP code are shown in quotes, while non-literals will require JSP scriptlet syntax (such as
addaddress.jsp (Windows)
$PORTAL_HOME/applications/wlcsApp/wlcs/commerce/order/
addaddress.jsp (UNIX)<%@ taglib uri="webflow.tld" prefix="webflow" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="com.beasys.commerce.webflow.tags.*" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="examples.wlcs.sampleapp.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>
<%= HttpRequestConstants.CUSTOMER_SHIPPING_CITY %>) for use in the JSP.
Input Processors
This section provides a brief description of each input processor associated with the Shipping Services JSP template(s).
InitShippingMethodListIP
UpdateShippingAddressIP
ValidateAddressIP
ValidateShippingInfoIP
Pipeline Components
This section provides a brief description of each Pipeline component associated with the Shipping Services JSP template(s).
Notes: For information about the TaxVerifyShippingAddressPC and TaxCalculateLineLevelPC Pipeline components, see Taxation Services.
Some Pipeline components extend other, base Pipeline components. For more information on the base classes, see the Javadoc.
AddShippingAddressPC
CalculateShippingPC
DeleteShippingAddressPC
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|