You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mo...@apache.org on 2008/07/02 15:59:02 UTC
svn commit: r673395 - in /ofbiz/trunk/applications/ecommerce:
script/org/ofbiz/ecommerce/customer/ webapp/ecommerce/WEB-INF/
webapp/ecommerce/images/ webapp/ecommerce/order/
Author: mor
Date: Wed Jul 2 06:59:02 2008
New Revision: 673395
URL: http://svn.apache.org/viewvc?rev=673395&view=rev
Log:
Continuing effort from Sumit Pandit, Brajesh Patel, Rishi Solanki and Santosh Malviya for One Page Checkout page process
Now Billing address and Payment information (Credit Card only) is handled.
Modified:
ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml
ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
Modified: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml?rev=673395&r1=673394&r2=673395&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml (original)
+++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml Wed Jul 2 06:59:02 2008
@@ -82,6 +82,12 @@
<process field="shippingContactMechId">
<copy to-field="contactMechId" set-if-null="false"/>
</process>
+ <process field="shipToName">
+ <copy to-field="toName" set-if-null="false"/>
+ </process>
+ <process field="shipToAttnName">
+ <copy to-field="attnName" set-if-null="false"/>
+ </process>
<process field="shipToAddress1">
<copy to-field="address1"/>
<not-empty>
@@ -121,7 +127,7 @@
<process field="billToContactMechId">
<copy to-field="contactMechId" set-if-null="false"/>
</process>
- <process field="billToToName">
+ <process field="billToName">
<copy to-field="toName" set-if-null="false"/>
</process>
<process field="billToAttnName">
@@ -162,64 +168,4 @@
</process>
</simple-map-processor>
- <simple-map-processor name="creditCard">
- <make-in-string field="expireDate">
- <in-field field="expMonth"/>
- <constant>/</constant>
- <in-field field="expYear"/>
- </make-in-string>
- <process field="productStoreId"><copy/></process>
- <process field="paymentMethodId">
- <copy/>
- </process>
- <process field="contactMechId">
- <copy/>
- </process>
- <process field="firstNameOnCard">
- <copy/>
- <not-empty>
- <fail-property resource="EcommerceUiLabels" property="PartyFirstNameOnCardMissingError"/>
- </not-empty>
- </process>
- <process field="middleNameOnCard">
- <copy/>
- </process>
- <process field="lastNameOnCard">
- <copy/>
- <not-empty>
- <fail-property resource="EcommerceUiLabels" property="PartyLastNameOnCardMissingError"/>
- </not-empty>
- </process>
- <process field="cardType">
- <copy/>
- <not-empty>
- <fail-property resource="EcommerceUiLabels" property="PartyCardTypeMissingError"/>
- </not-empty>
- </process>
- <process field="cardNumber">
- <copy/>
- <not-empty>
- <fail-property resource="EcommerceUiLabels" property="PartyCardNumberMissingError"/>
- </not-empty>
- </process>
- <process field="expMonth">
- <copy/>
- <not-empty>
- <fail-property resource="EcommerceUiLabels" property="PartyExpMonthMissingError"/>
- </not-empty>
- </process>
- <process field="expYear">
- <copy/>
- <not-empty>
- <fail-property resource="EcommerceUiLabels" property="PartyExpYearMissingError"/>
- </not-empty>
- </process>
- <process field="expireDate">
- <copy/>
- <validate-method method="isDateAfterToday">
- <fail-property resource="EcommerceUiLabels" property="PartyExpDateBeforeTodayError"/>
- </validate-method>
- </process>
- </simple-map-processor>
-
</simple-map-processors>
Modified: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?rev=673395&r1=673394&r2=673395&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml (original)
+++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml Wed Jul 2 06:59:02 2008
@@ -847,7 +847,6 @@
<simple-method method-name="createUpdateCustomerAndShippingContact"
short-description="Create/Update Customer, Shipping Address and other contact details. Set shipping method type" login-required="false">
-
<set field="shoppingCart" from-field="parameters.shoppingCart"/>
<set field="partyId" from-field="parameters.partyId"/>
<set field="userLogin" from-field="parameters.userLogin"/>
@@ -871,6 +870,7 @@
<if-empty field="shippingContactMechId">
<set field="shippingContactMechId" from-field="parameters.shippingContactMechId"/>
</if-empty>
+ <set field="parameters.shipToName" value="${parameters.firstName} ${parameters.lastName}"/>
<call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
processor-name="person" in-map-name="parameters" out-map-name="personMap"/>
@@ -925,7 +925,6 @@
<!-- Create Or Update ship to address.-->
<set field="shipToAddressContext.partyId" from-field="partyId"/>
<set field="shipToAddressContext.roleTypeId" from-field="parameters.roleTypeId"/>
- <set field="shipToAddressContext.attnName" value="${personContext.firstName} ${personContext.lastName}"/>
<set field="shipToAddressContext.userLogin" from-field="userLogin"/>
<if-empty field="shippingContactMechId">
@@ -996,7 +995,7 @@
<field field-name="parameters.shippingContactMechId"/>
</call-object-method>
<call-object-method obj-field-name="shoppingCart" method-name="setShippingContactMechId">
- <field field-name="shippingContactMechId"/>
+ <field field-name="parameters.shippingContactMechId"/>
</call-object-method>
<log level="info" message="updated shopping cart shippingContactMechId ${parameters.shippingContactMechId}"/>
<call-object-method obj-field-name="shoppingCart" method-name="setOrderPartyId">
@@ -1004,4 +1003,153 @@
</call-object-method>
</simple-method>
+
+ <simple-method method-name="setShippingOption"
+ short-description="Set shipping method" login-required="false">
+ </simple-method>
+
+ <simple-method method-name="createUpdateBillingAndPayment" short-description="Create/update billing address and payment information" login-required="false">
+ <set field="shoppingCart" from-field="parameters.shoppingCart"/>
+ <if-empty field="shoppingCart">
+ <session-to-field field-name="shoppingCart"/>
+ </if-empty>
+ <if-not-empty field="shoppingCart">
+ <call-object-method obj-field-name="shoppingCart" method-name="getPartyId" ret-field-name="partyId"/>
+ <call-object-method obj-field-name="shoppingCart" method-name="getUserLogin" ret-field-name="userLogin"/>
+ <call-object-method obj-field-name="shoppingCart" method-name="getShippingContactMechId" ret-field-name="shippingContactMechId"/>
+ </if-not-empty>
+ <if-empty field="parameters.shippingContactMechId">
+ <set field="parameters.shippingContactMechId" from-field="shippingContactMechId"/>
+ </if-empty>
+ <set-current-user-login value-name="userLogin"/>
+
+ <!--=================== Validate Bill and Payment settings ================-->
+ <call-map-processor xml-resource="org/ofbiz/accounting/payment/PaymentMapProcs.xml"
+ processor-name="createCreditCard" in-map-name="parameters" out-map-name="creditCardContext"/>
+
+ <if-compare field="parameters.useShippingAddressForBilling" operator="not-equals" value="Y">
+ <set field="parameters.billToName" value="${parameters.firstNameOnCard} ${parameters.lastNameOnCard}"/>
+ <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml"
+ processor-name="billToAddress" in-map-name="parameters" out-map-name="billToAddressContext"/>
+ <map-to-map map-name="billToAddressContext" to-map-name="billToAddressAndCreditCardCtx"/>
+ <map-to-map map-name="creditCardContext" to-map-name="billToAddressAndCreditCardCtx"/>
+ <if-compare field="parameters.billToCountryGeoId" value="USA" operator="equals">
+ <if-empty field="parameters.billToStateProvinceGeoId">
+ <set field="tempErrorMessage" value="State is missing, and is required for an address in the United States."/>
+ <field-to-list field-name="tempErrorMessage" list-name="error_list"/>
+ </if-empty>
+ </if-compare>
+ <check-errors/>
+ <set field="billToAddressAndCreditCardCtx.partyId" from-field="partyId"/>
+ <set field="creditCardContext.partyId" from-field="partyId"/>
+ <set field="creditCardContext.userLogin" from-field="userLogin"/>
+ <if-empty field="parameters.billToContactMechId">
+ <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList">
+ <field-map field-name="partyId" env-name="userLogin.partyId"/>
+ <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+ </entity-and>
+ <filter-list-by-date list-name="pcmpList"/>
+ <first-from-list list-name="pcmpList" entry-name="pcmp"/>
+ <if-not-empty field="pcmp">
+ <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="deletePartyContactMechPurposeCtx"/>
+ <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="deletePartyContactMechPurposeCtx"/>
+ </if-not-empty>
+ <entity-and entity-name="PaymentMethod" list-name="paymentMethodList">
+ <field-map field-name="partyId" env-name="parameters.partyId"/>
+ <order-by field-name="-fromDate"/>
+ </entity-and>
+ <filter-list-by-date list-name="paymentMethodList"/>
+ <first-from-list list-name="paymentMethodList" entry-name="paymentMethod"/>
+ <set field="billToAddressAndCreditCardCtx.paymentMethodId" from-field="paymentMethod.paymentMethodId"/>
+ <!-- Create Credit Card and Address -->
+ <call-service service-name="createCreditCardAndAddress" in-map-name="billToAddressAndCreditCardCtx">
+ <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+ <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
+ </call-service>
+ <else>
+ <!-- Update Credit Card and Address -->
+ <set field="billToAddressAndCreditCardCtx.contactMechId" from-field="parameters.billToContactMechId"/>
+ <set field="billToAddressAndCreditCardCtx.paymentMethodId" from-field="parameters.paymentMethodId"/>
+ <call-service service-name="updateCreditCardAndAddress" in-map-name="billToAddressAndCreditCardCtx">
+ <result-to-field result-name="contactMechId" field-name="parameters.billToContactMechId"/>
+ <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
+ </call-service>
+ <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList">
+ <field-map field-name="partyId" env-name="userLogin.partyId"/>
+ <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+ </entity-and>
+ <filter-list-by-date list-name="pcmpList"/>
+ <first-from-list list-name="pcmpList" entry-name="pcmp"/>
+ <if-compare-field field="parameters.billToContactMechId" operator="not-equals" to-field="pcmp.contactMechId">
+ <if-not-empty field="pcmp">
+ <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="deletePartyContactMechPurposeCtx"/>
+ <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="deletePartyContactMechPurposeCtx"/>
+ <set-service-fields service-name="deletePartyContactMech" map-name="pcmp" to-map-name="serviceInMap"/>
+ <call-service service-name="deletePartyContactMech" in-map-name="serviceInMap"/>
+ </if-not-empty>
+ </if-compare-field>
+ </else>
+ </if-empty>
+ <field-to-request field-name="parameters.paymentMethodId" request-name="paymentMethodId"/>
+ <field-to-request field-name="parameters.billToContactMechId" request-name="billToContactMechId"/>
+ </if-compare>
+
+ <if-compare field="parameters.useShippingAddressForBilling" operator="equals" value="Y">
+ <entity-and entity-name="PartyContactMechPurpose" list-name="pcmpList">
+ <field-map field-name="partyId" env-name="userLogin.partyId"/>
+ <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+ </entity-and>
+ <filter-list-by-date list-name="pcmpList"/>
+ <first-from-list list-name="pcmpList" entry-name="pcmp"/>
+ <if-compare-field field="parameters.shippingContactMechId" operator="not-equals" to-field="pcmp.contactMechId">
+ <if-not-empty field="pcmp">
+ <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map-name="pcmp" to-map-name="deletePartyContactMechPurposeCtx"/>
+ <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="deletePartyContactMechPurposeCtx"/>
+ <set-service-fields service-name="deletePartyContactMech" map-name="pcmp" to-map-name="serviceInMap"/>
+ <call-service service-name="deletePartyContactMech" in-map-name="serviceInMap"/>
+ </if-not-empty>
+ <set field="createPartyContactMechPurposeCtx.partyId" from-field="userLogin.partyId"/>
+ <set field="createPartyContactMechPurposeCtx.contactMechId" from-field="parameters.shippingContactMechId"/>
+ <set field="createPartyContactMechPurposeCtx.contactMechPurposeTypeId" value="BILLING_LOCATION"/>
+ <call-service service-name="createPartyContactMechPurpose" in-map-name="createPartyContactMechPurposeCtx"/>
+ </if-compare-field>
+ <field-to-request field-name="parameters.shippingContactMechId" request-name="billToContactMechId"/>
+
+ <set field="creditCardContext.contactMechId" from-field="parameters.shippingContactMechId"/>
+ <if-empty field="parameters.paymentMethodId">
+ <!-- Create Credit Card -->
+ <call-service service-name="createCreditCard" in-map-name="creditCardContext">
+ <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
+ </call-service>
+ <else>
+ <entity-and entity-name="PaymentMethod" list-name="paymentMethodList">
+ <field-map field-name="partyId" env-name="parameters.partyId"/>
+ <order-by field-name="-fromDate"/>
+ </entity-and>
+ <filter-list-by-date list-name="paymentMethodList"/>
+ <first-from-list list-name="paymentMethodList" entry-name="paymentMethod"/>
+ <set field="creditCardContext.paymentMethodId" from-field="paymentMethod.paymentMethodId"/>
+ <!-- Update Credit Card -->
+ <set field="creditCardContext.paymentMethodId" from-field="parameters.paymentMethodId"/>
+ <call-service service-name="updateCreditCard" in-map-name="creditCardContext">
+ <result-to-field result-name="paymentMethodId" field-name="parameters.paymentMethodId"/>
+ </call-service>
+ </else>
+ </if-empty>
+ <field-to-request field-name="parameters.paymentMethodId" request-name="paymentMethodId"/>
+ </if-compare>
+
+ <!--============== Set Payment Method ================-->
+ <set field="paymentMethodId" from-field="parameters.paymentMethodId"/>
+ <set field="cardSecurityCode" from-field="parameters.cardSecurityCode"/>
+ <call-bsh>
+ <![CDATA[
+ import org.ofbiz.order.shoppingcart.ShoppingCart;
+ checkOutHelper = new org.ofbiz.order.shoppingcart.CheckOutHelper(dispatcher, delegator, shoppingCart);
+ callResult = checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, false, false);
+ ShoppingCart.CartPaymentInfo cpi = shoppingCart.getPaymentInfo(paymentMethodId, null, null, null, true);
+ cpi.securityCode = cardSecurityCode;
+ ]]>
+ </call-bsh>
+ </simple-method>
</simple-methods>
Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=673395&r1=673394&r2=673395&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Wed Jul 2 06:59:02 2008
@@ -1590,6 +1590,20 @@
<response name="error" type="none"/>
</request-map>
+ <request-map uri="setShippingOption">
+ <security https="true" auth="false"/>
+ <event type="jsonsimple" path="org/ofbiz/ecommerce/customer/CustomerEvents.xml" invoke="setShippingOption"/>
+ <response name="success" type="request" value="onePageCheckout"/>
+ <response name="error" type="none"/>
+ </request-map>
+
+ <request-map uri="createUpdateBillingAndPayment">
+ <security https="true" auth="false"/>
+ <event type="jsonsimple" path="org/ofbiz/ecommerce/customer/CustomerEvents.xml" invoke="createUpdateBillingAndPayment"/>
+ <response name="success" type="none"/>
+ <response name="error" type="none"/>
+ </request-map>
+
<!-- End of Request Mappings -->
<!-- View Mappings -->
Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js?rev=673395&r1=673394&r2=673395&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Wed Jul 2 06:59:02 2008
@@ -30,35 +30,41 @@
// Shipping
Event.observe($('editShippingOptions'), 'click', function() {
processShippingAddress();
- displayShippingOptionPanel();
+ displayShippingOptionPanel();
});
Event.observe($('openShippingPanel'), 'click', function() {
- displayShippingPanel();
+ displayShippingPanel();
});
// Shipping Options
Event.observe($('editBilling'), 'click', function() {
- displayBillingPanel();
+ // TODO : Will be uncomment soon.
+ //setShippingOption();
+ displayBillingPanel();
});
Event.observe($('openShippingOptionPanel'), 'click', function() {
- displayShippingOptionPanel();
+ displayShippingOptionPanel();
});
// Billing
Event.observe($('openBillingPanel'), 'click', function() {
- displayBillingPanel();
+ displayBillingPanel();
});
Event.observe($('openOrderSubmitPanel'), 'click', function() {
- displayOrderSubmitPanel();
+ processBillingAndPayment();
+ displayOrderSubmitPanel();
});
+
+ // For Billing Address Same As Shipping
+ Event.observe('useShippingAddressForBilling', 'click', useShippingAddressForBillingToggel);
});
// Cart
function displayShippingPanel() {
- if(!$('editShippingPanel').visible()) {
+ if (!$('editShippingPanel').visible()) {
Effect.BlindDown('editShippingPanel', {duration: 0.5});
Effect.BlindUp('editCartPanel', {duration: 0.5});
Effect.BlindUp('editShippingOptionPanel', {duration: 0.5});
@@ -73,7 +79,7 @@
}
}
function displayCartPanel() {
- if(!$('editCartPanel').visible()) {
+ if (!$('editCartPanel').visible()) {
Effect.BlindDown('editCartPanel', {duration: 0.5});
Effect.BlindUp('editShippingPanel', {duration: 0.5});
Effect.BlindUp('editShippingOptionPanel', {duration: 0.5});
@@ -90,7 +96,7 @@
// Shipping
function displayShippingOptionPanel() {
- if(!$('editShippingOptionPanel').visible()) {
+ if (!$('editShippingOptionPanel').visible()) {
Effect.BlindDown('editShippingOptionPanel', {duration: 0.5});
Effect.BlindDown('shippingCompleted', {duration: 0.5});
Effect.BlindUp('editCartPanel', {duration: 0.5});
@@ -109,8 +115,9 @@
// Billing
function displayBillingPanel() {
- if(!$('editBillingPanel').visible()) {
+ if (!$('editBillingPanel').visible()) {
Effect.BlindDown('editBillingPanel', {duration: 0.5});
+ Effect.BlindDown('shippingOptionCompleted', {duration: 0.5});
Effect.BlindUp('editCartPanel', {duration: 0.5});
Effect.BlindUp('editShippingPanel', {duration: 0.5});
Effect.BlindUp('editShippingOptionPanel', {duration: 0.5});
@@ -122,40 +129,41 @@
Effect.Appear('shippingOptionSummaryPanel', {duration: 0.5});
//Effect.Appear('orderSubmitPanel', {duration: 0.5});
}
+ setDataInShippingOptionCompleted();
}
// Order Submit
function displayOrderSubmitPanel() {
- if(!$('orderSubmitPanel').visible()) {
+ if (!$('orderSubmitPanel').visible()) {
Effect.BlindDown('orderSubmitPanel', {duration: 0.5});
+ Effect.BlindDown('billingCompleted', {duration: 0.5});
Effect.BlindUp('editCartPanel', {duration: 0.5});
Effect.BlindUp('editShippingPanel', {duration: 0.5});
Effect.BlindUp('editShippingOptionPanel', {duration: 0.5});
Effect.BlindUp('editBillingPanel', {duration: 0.5});
- //Effect.Fade('billingSummaryPanel', {duration: 0.5});
Effect.Appear('cartSummaryPanel', {duration: 0.5});
Effect.Appear('shippingSummaryPanel', {duration: 0.5});
Effect.Appear('shippingOptionSummaryPanel', {duration: 0.5});
Effect.Appear('billingSummaryPanel', {duration: 0.5});
- }
+ }
+ setDataInBillingCompleted();
}
function processShippingAddress() {
- console.log('shippingForm' +$('shippingForm').serialize());
new Ajax.Request('/ecommerce/control/createUpdateShippingAddress', {
- asynchronous: true,
+ asynchronous: false,
onSuccess: function(transport) {
var data = transport.responseText.evalJSON(true);
console.log(data);
if (data._ERROR_MESSAGE_LIST_ != undefined) {
console.log(data._ERROR_MESSAGE_LIST_);
- }else if (data._ERROR_MESSAGE_ != undefined) {
- if (data._ERROR_MESSAGE_LIST_ == "SessionTimedOut"){
+ } else if (data._ERROR_MESSAGE_ != undefined) {
+ if (data._ERROR_MESSAGE_LIST_ == "SessionTimedOut") {
console.log('session time out');
}
console.log(data._ERROR_MESSAGE_);
- }else {
+ } else {
// Process Shipping data response.
$('shippingPartyId').value = data.partyId;
$('shippingContactMechId').value = data.shippingContactMechId;
@@ -168,7 +176,6 @@
}
function setDataInShippingCompleted() {
- console.log('calling the set method');
var fullName = $('firstName').value + " " +$('lastName').value;
var shippingContactPhoneNumber = $F('shippingCountryCode')+ "-" + $F('shippingAreaCode')
+ "-" + $F('shippingContactNumber')+ "-" + $F('shippingExtension');
@@ -179,4 +186,89 @@
$('completedShipToAddress2').update($('shipToAddress2').value);
var shipToGeo = $('shipToCity').value+","+$('shipToStateProvinceGeoId').value +" "+$('shipToCountryGeoId').value+" "+$('shipToPostalCode').value;
$('completedShipToGeo').update(shipToGeo);
+ // set shippingContactMechId in Billing form.
+ $('shippingContactMechIdInBillingForm').value = $F('shippingContactMechId');
+}
+
+// Shipping option
+var shipTotal = null;
+var shipMethod = null;
+function setShippingOption() {
+ new Ajax.Request('/ecommerce/control/setShippingOption', {
+ asynchronous: false,
+ onSuccess: function(transport) {
+ var data = transport.responseText.evalJSON(true);
+ console.log(data);
+ shipMethod = data.shippingDescription;
+ shipTotal = data.shippingTotal;
+ if (data._ERROR_MESSAGE_LIST_ != undefined) {
+ console.log(data._ERROR_MESSAGE_LIST_);
+ } else if (data._ERROR_MESSAGE_ != undefined) {
+ if (data._ERROR_MESSAGE_LIST_ == "SessionTimedOut") {
+ console.log('session time out');
+ }
+ console.log(data._ERROR_MESSAGE_);
+ } else {
+ $('shippingDescription').value = data.shippingDescription;
+ $('shippingTotal').value = data.shippingTotal;
+ $('cartGrandTotal').value = data.cartGrandTotal;
+ $('totalSalesTax').value = data.totalSalesTax;
+ }
+ }, parameters: $('shippingOptionForm').serialize(), requestHeaders: {Accept: 'application/json'}
+ });
+}
+
+function setDataInShippingOptionCompleted() {
+ var shipOpt = shipMethod +'-'+shipTotal;
+ $('selectedShipmentOption').update(shipOpt);
+}
+
+// Billing
+function useShippingAddressForBillingToggel() {
+ if($('useShippingAddressForBilling').checked) {
+ $('billToAddress1').value = $F('shipToAddress1');
+ $('billToAddress2').value = $F('shipToAddress2');
+ $('billToCity').value = $F('shipToCity');
+ $('billToStateProvinceGeoId').value = $F('shipToStateProvinceGeoId');
+ $('billToPostalCode').value = $F('shipToPostalCode');
+ $('billToCountryGeoId').value = $F('shipToCountryGeoId');
+ Effect.BlindUp($('billingAddress'), {duration: 0.5});
+ } else {
+ Effect.BlindDown($('billingAddress'), {duration: 0.5});
+ }
+}
+
+function processBillingAndPayment() {
+ new Ajax.Request('/ecommerce/control/createUpdateBillingAndPayment', {
+ asynchronous: false,
+ onSuccess: function(transport) {
+ var data = transport.responseText.evalJSON(true);
+ console.log(data);
+ if (data._ERROR_MESSAGE_LIST_ != undefined) {
+ console.log(data._ERROR_MESSAGE_LIST_);
+ } else if (data._ERROR_MESSAGE_ != undefined) {
+ if (data._ERROR_MESSAGE_LIST_="SessionTimedOut") {
+ console.log('session time out');
+ }
+ console.log(data._ERROR_MESSAGE_);
+ } else {
+ $('billToContactMechId').value = data.billToContactMechId;
+ $('paymentMethodId').value = data.paymentMethodId;
+ }
+ }, parameters: $('billingForm').serialize(), requestHeaders: {Accept: 'application/json'}
+ });
+}
+
+function setDataInBillingCompleted() {
+ var fullName = $F('firstNameOnCard') + " " +$F('lastNameOnCard');
+ $('completedBillToAttn').update("Attn: " + fullName);
+ var cardNumber = "CC#:XXXXXXXXXXXX"+$F('cardNumber').gsub('-','').slice(12,16);
+ $('completedCCNumber').update(cardNumber);
+ var expiryDate = "Expires:"+$F('expMonth')+"/"+$F('expYear');
+ $('completedExpiryDate').update(expiryDate);
+ $('completedBillToAddress1').update($F('billToAddress1'));
+ $('completedBillToAddress2').update($F('billToAddress2'));
+ var billToGeo = $F('billToCity')+","+$F('billToStateProvinceGeoId') +" "+$F('billToCountryGeoId')+" "+$F('billToPostalCode');
+ $('completedBillToGeo').update(billToGeo);
+ $('paymentMethod').update($F('paymentMethodTypeId'));
}
\ No newline at end of file
Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl?rev=673395&r1=673394&r2=673395&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Wed Jul 2 06:59:02 2008
@@ -182,7 +182,7 @@
<label for="shipToPostalCode"> ${uiLabelMap.FormFieldTitleZipCode}<span class="requiredLabel"> *</span><span id="advice-required-shipToPostalCode" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-zip-shipToPostalCode" class="custom-advice" style="display:none">(required)</span></label>
</div>
<div class="field-widget">
- <input id="shipToPostalCode" name="shipToPostalCode" class="required validate-zip input_mask mask_zip" type="text" value="${parameters.shipToPostalCode?if_exists}"/>
+ <input id="shipToPostalCode" name="shipToPostalCode" class="required validate-zip input_mask mask_zip" type="text" value="${parameters.shipToPostalCode?if_exists}" maxlength=8/>
</div>
</div>
<div class="form-row">
@@ -283,8 +283,40 @@
<div class="screenlet-header"><div class="boxhead" align="left">Step 4: Billing</div></div>
<div id="billingSummaryPanel">
<div align="left" style="width: auto; padding: 10px 40px 30px 40px;"><a href="javascript:void(0);" id="openBillingPanel"><h3>Click here to edit</h3></a></div>
- <div id="billingSummary" style="display: none;">
- Billing and Payment summary.
+ <div class="completed" id="billingCompleted" style="display: none;">
+ <a href="javascript:void(0);" id="openBillingAndPersonlDetail">
+ <h3>Billing and Payment Summary</h3>
+ </a>
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr>
+ <td style=" padding: 6px; width: 60px;" valign="top">Bill To:</td>
+ <td style=" padding: 6px; width: 60px;" valign="top">
+ <div>
+ <div id="completedBillToAttn"></div>
+ <div id="completedCCNumber"></div>
+ <div id="completedExpiryDate"></div>
+ </div>
+ </td>
+ <td style=" padding: 6px; width: 60px;" valign="top">Location:</td>
+ <td style="padding: 6px; width: 60px;" valign="top">
+ <div>
+ <div id="completedBillToAddress1"></div>
+ <div id="completedBillToAddress2"></div>
+ <div id="completedBillToGeo"></div>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td style=" padding: 6px; width: 60px;" valign="top">Payment Method:</td>
+ <td style="padding: 6px; width: 80px;" valign="top">
+ <div>
+ <div id="paymentMethod"></div>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
</div>
<div id="editBillingPanel" style="display: none;">
@@ -293,13 +325,10 @@
<input type="hidden" id ="billToContactMechId" name="billToContactMechId" value="${parameters.billToContactMechId?if_exists}"/>
<input type="hidden" id="shippingContactMechIdInBillingForm" name="shippingContactMechId" value="${parameters.shippingContactMechId?if_exists}"/>
<input type="hidden" id="paymentMethodId" name="paymentMethodId" value="${parameters.paymentMethodId?if_exists}"/>
- <input type="hidden" name="singleUsePayment" value="Y"/>
- <input type="hidden" name="appendPayment" value="Y"/>
<input type="hidden" id="paymentMethodTypeId" name="paymentMethodTypeId" value="CREDIT_CARD"/>
<input type="hidden" id="billingPartyId" name="partyId" value="${parameters.partyId?if_exists}"/>
<input type="hidden" name="userLogin" value="${parameters.userLogin?if_exists}"/>
<input type="hidden" name="expireDate" value="${parameters.expireDate?if_exists}"/>
- <input type="hidden" id="billToPhoneContactMechId" name="phoneContactMechId" value="${parameters.billToPhoneContactMechId?if_exists}"/>
<input type="hidden" id="cardType" name="cardType" value="Visa"/>
<div class="panelBody" id="billingId">
<table id="billingTable">
@@ -362,12 +391,12 @@
<fieldset class="right">
<div class="form-row">
<span>
- <input class="checkbox" id="sameAsShipping" name="sameAsShipping" type="checkbox" value="Y" <#if parameters.sameAsShipping?has_content && parameters.sameAsShipping?default("")=="Y">checked</#if>>
+ <input class="checkbox" id="useShippingAddressForBilling" name="useShippingAddressForBilling" type="checkbox" value="Y" <#if parameters.useShippingAddressForBilling?has_content && parameters.useShippingAddressForBilling?default("")=="Y">checked</#if>>
<span style="font-size:10px; float:left; padding:0px 0px 0px 6px; margin-top:10px; width:300px">${uiLabelMap.FacilityBillingAddressSameShipping}</span>
</span>
</div>
<div style="clear: both"></div>
- <div id="billingAddress" <#if parameters.sameAsShipping?has_content && parameters.sameAsShipping?default("")=="Y">style="display:none"</#if>>
+ <div id="billingAddress" <#if parameters.useShippingAddressForBilling?has_content && parameters.useShippingAddressForBilling?default("")=="Y">style="display:none"</#if>>
<div class="form-row">
<div class="field-label">
<label for="address1">${uiLabelMap.PartyAddressLine1}<span class="requiredLabel"> *</span><span id="advice-required-billToAddress1" class="custom-advice" style="display:none">(required)</span></label>
@@ -414,31 +443,13 @@
<div class="form-row">
<div class="field-label">
- <label for="billingContactPhoneNumber">${uiLabelMap.PartyZipCode}<span class="requiredLabel"> *</span><span id="advice-required-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-phone-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span></label>
+ <label for="billToPostalCode">${uiLabelMap.PartyZipCode}<span class="requiredLabel"> *</span><span id="advice-required-billToPostalCode" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-billToPostalCode" class="custom-advice" style="display:none">(required)</span></label>
</div>
<div class="field-widget">
<input id="billToPostalCode" name="billToPostalCode" class="required validate-zip input_mask mask_zip" type="text" value="${parameters.billToPostalCode?if_exists}" />
</div>
</div>
<div class="form-row">
- <div class="field-label">
- <label for="countryCode">Country Code<span class="requiredLabel"> *</span><span id="advice-required-shippingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-phone-shippingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span></label>
- <input name="countryCode" class="input_mask mask_phone required validate-phone" id="billingCountryCode" value="${parameters.countryCode?if_exists}" size="3" maxlength=3>
- </div>
- <div class="field-label">
- <label for="areaCode">Area Code<span class="requiredLabel"> *</span><span id="advice-required-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-phone-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span></label>
- <input name="areaCode" class="input_mask mask_phone required validate-phone" id="billingAreaCode" value="${parameters.areaCode?if_exists}" size="3" maxlength=4>
- </div>
- <div class="field-label">
- <label for="contactNumber">Contact Number<span class="requiredLabel"> *</span><span id="advice-required-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-phone-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span></label>
- <input name="contactNumber" class="input_mask mask_phone required validate-phone" id="billingContactNumber" value="${parameters.contactNumber?if_exists}" size="5" maxlength=6>
- </div>
- <div class="field-label">
- <label for="extension">Extention<span class="requiredLabel"> *</span><span id="advice-required-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-phone-billingContactPhoneNumber" class="custom-advice" style="display:none">(required)</span></label>
- <input name="extension" class="input_mask mask_phone required validate-phone" id="billingExtension" value="${parameters.extension?if_exists}" size="3" maxlength=3>
- </div>
- </div>
- <div class="form-row">
<div class="form-label">${uiLabelMap.PartyCountry}</div>
<div class="form-field">
<select name="billToCountryGeoId" id="billToCountryGeoId" class="selectBox">
@@ -460,7 +471,6 @@
<div><h3><span class="editStep"><a href="javascript:void(0);" id="openOrderSubmitPanel"><h3>Continue for step 5</h3></a></span></h3></div>
</div>
</div>
-
<div id="" class="screenlet">
<div class="screenlet-header"><div class="boxhead" align="left">Step 5: Submit Order</div></div>
<div id="orderSubmitPanel" style="display: none;">