Author: apatel
Date: Sat Jun 28 11:01:57 2008 New Revision: 672561 URL: http://svn.apache.org/viewvc?rev=672561&view=rev Log: Extending the work Vikas started on New checkout process code. Still not complete. Once we'll start removing un-used old stuff. Added: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml (with props) Modified: ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.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/config/EcommerceUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.xml?rev=672561&r1=672560&r2=672561&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.xml (original) +++ ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.xml Sat Jun 28 11:01:57 2008 @@ -6262,6 +6262,9 @@ <value xml:lang="th">รหัสà¸à¸·à¹à¸à¸à¸µà¹</value> <value xml:lang="zh">å°åºä»£ç </value> </property> + <property key="PartyAreaCodeMissingError"> + <value xml:lang="en">Area code is missing</value> + </property> <property key="PartyAttentionName"> <value xml:lang="cs">Jméno</value> <value xml:lang="de">Zu Händen von</value> @@ -6376,6 +6379,12 @@ <value xml:lang="th">à¹à¸à¸à¸£à¹à¹à¸à¸£à¸¨à¸±à¸à¸à¹à¸à¸à¸à¸à¸£à¸´à¸©à¸±à¸</value> <value xml:lang="zh">åå ¬çµè¯</value> </property> + <property key="PartyCardNumberMissingError"> + <value xml:lang="en">Card number is missing</value> + </property> + <property key="PartyCardTypeMissingError"> + <value xml:lang="en">Card type is missing</value> + </property> <property key="PartyChangePassword"> <value xml:lang="cs">ZmÄnit heslo</value> <value xml:lang="de">Passwort ändern</value> @@ -6612,6 +6621,9 @@ <value xml:lang="th">รหัสà¸à¸£à¸°à¹à¸à¸¨</value> <value xml:lang="zh">å½å®¶ä»£ç </value> </property> + <property key="PartyCountryCodeMissing"> + <value xml:lang="en">Country code is Missing</value> + </property> <property key="PartyCountryMissing"> <value xml:lang="cs">Chybà zemÄ</value> <value xml:lang="de">Land fehlt</value> @@ -6832,6 +6844,15 @@ <value xml:lang="th">à¸à¸¸à¸à¸à¹à¸à¸à¹à¸à¹à¸²à¸£à¸«à¸±à¸ªà¸à¸à¸à¸à¸¸à¸à¸ªà¸à¸à¸à¸£à¸±à¹à¸</value> <value xml:lang="zh">ä½ å¿ é¡»è¾å ¥å¯ç 两次</value> </property> + <property key="PartyExpDateBeforeTodayError"> + <value xml:lang="en">The expiration date is before today</value> + </property> + <property key="PartyExpMonthMissingError"> + <value xml:lang="en">Expiration month is missing</value> + </property> + <property key="PartyExpYearMissingError"> + <value xml:lang="en">Expiration year is missing</value> + </property> <property key="PartyExtension"> <value xml:lang="cs">Linka</value> <value xml:lang="de">Durchwahl</value> @@ -6897,6 +6918,9 @@ <value xml:lang="th">à¹à¸¡à¹à¹à¸à¹à¹à¸ªà¹à¸à¸·à¹à¸</value> <value xml:lang="zh">æ¾ä¸å°åå</value> </property> + <property key="PartyFirstNameOnCardMissingError"> + <value xml:lang="en">First name on card is missing </value> + </property> <property key="PartyGender"> <value xml:lang="cs">PohlavÃ</value> <value xml:lang="de">Geschlecht</value> @@ -7035,6 +7059,9 @@ <value xml:lang="th">à¹à¸¡à¹à¹à¸à¹à¹à¸ªà¹à¸à¸²à¸¡à¸ªà¸à¸¸à¸¥</value> <value xml:lang="zh">æ¾ä¸å°å§æ°</value> </property> + <property key="PartyLastNameOnCardMissingError"> + <value xml:lang="en">Last name on card is missing</value> + </property> <property key="PartyMaidenName"> <value xml:lang="cs">Rodné jméno</value> <value xml:lang="de">Geburtsname</value> @@ -7721,6 +7748,9 @@ <value xml:lang="th">à¹à¸¡à¸·à¸à¸/à¸à¸±à¸à¸«à¸§à¸±à¸</value> <value xml:lang="zh">å·/ç</value> </property> + <property key="PartyStateMissingError"> + <value xml:lang="en">State is missing</value> + </property> <property key="PartySuffix"> <value xml:lang="cs">PÅÃpona</value> <value xml:lang="de">Suffix</value> Added: 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=672561&view=auto ============================================================================== --- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml (added) +++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml Sat Jun 28 11:01:57 2008 @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<simple-map-processors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd"> + + <simple-map-processor name="person"> + <process field="firstName"> + <copy/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyFirstNameMissing"/> + </not-empty> + </process> + <process field="lastName"> + <copy/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyLastNameMissingError"/> + </not-empty> + </process> + </simple-map-processor> + + <simple-map-processor name="phoneNumber"> + <process field="phoneContactMechId"> + <copy to-field="contactMechId" set-if-null="false"/> + </process> + <process field="countryCode"> + <copy/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyCountryCodeMissing"/> + </not-empty> + </process> + <process field="areaCode"> + <copy/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyAreaCodeMissingError"/> + </not-empty> + </process> + <process field="contactNumber"> + <copy/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyContactTelephoneMissingError"/> + </not-empty> + </process> + <process field="extension"> + <copy/> + </process> + </simple-map-processor> + + <simple-map-processor name="emailAddress"> + <process field="emailContactMechId"> + <copy to-field="contactMechId" set-if-null="false"/> + </process> + <process field="emailAddress"> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyEmailAddressMissingError"/> + </not-empty> + <validate-method method="isEmail"> + <fail-property resource="EcommerceUiLabels" property="PartyEmailAddressNotFormattedCorrectly"/> + </validate-method> + <copy/> + </process> + </simple-map-processor> + + <simple-map-processor name="shipToAddress"> + <process field="shippingContactMechId"> + <copy to-field="contactMechId" set-if-null="false"/> + </process> + <process field="shipToAddress1"> + <copy to-field="address1"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyAddressLine1MissingError"/> + </not-empty> + </process> + <process field="shipToAddress2"> + <copy to-field="address2"/> + </process> + <process field="shipToCity"> + <copy to-field="city"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyCityMissing"/> + </not-empty> + </process> + <process field="shipToStateProvinceGeoId"> + <copy to-field="stateProvinceGeoId"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyStateMissingError"/> + </not-empty> + </process> + <process field="shipToPostalCode"> + <copy to-field="postalCode"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyPostalInformationNotFound"/> + </not-empty> + </process> + <process field="shipToCountryGeoId"> + <copy to-field="countryGeoId"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyCountryMissing"/> + </not-empty> + </process> + </simple-map-processor> + + <simple-map-processor name="billToAddress"> + <process field="billToContactMechId"> + <copy to-field="contactMechId" set-if-null="false"/> + </process> + <process field="billToToName"> + <copy to-field="toName" set-if-null="false"/> + </process> + <process field="billToAttnName"> + <copy to-field="attnName" set-if-null="false"/> + </process> + <process field="billToAddress1"> + <copy to-field="address1"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyAddressLine1MissingError"/> + </not-empty> + </process> + <process field="billToAddress2"> + <copy to-field="address2"/> + </process> + <process field="billToCity"> + <copy to-field="city"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyCityMissing"/> + </not-empty> + </process> + <process field="billToStateProvinceGeoId"> + <copy to-field="stateProvinceGeoId"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyStateMissingError"/> + </not-empty> + </process> + <process field="billToPostalCode"> + <copy to-field="postalCode"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyPostalInformationNotFound"/> + </not-empty> + </process> + <process field="billToCountryGeoId"> + <copy to-field="countryGeoId"/> + <not-empty> + <fail-property resource="EcommerceUiLabels" property="PartyCountryMissing"/> + </not-empty> + </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> Propchange: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml 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=672561&r1=672560&r2=672561&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 Sat Jun 28 11:01:57 2008 @@ -842,5 +842,164 @@ </if-not-empty> </if-not-empty> </simple-method> + + <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"/> + + <if-empty field="userLogin"> + <session-to-field field-name="userLogin" session-name="userLogin"/> + </if-empty> + <if-empty field="shoppingCart"> + <session-to-field field-name="shoppingCart"/> + </if-empty> + <if-not-empty field="shoppingCart"> + <if-empty field="partyId"> + <call-object-method obj-field-name="shoppingCart" method-name="getPartyId" ret-field-name="partyId"/> + </if-empty> + <if-empty field="userLogin"> + <call-object-method obj-field-name="shoppingCart" method-name="getUserLogin" ret-field-name="userLogin"/> + </if-empty> + <call-object-method obj-field-name="shoppingCart" method-name="getShippingContactMechId" ret-field-name="shippingContactMechId"/> + </if-not-empty> + + <if-empty field="shippingContactMechId"> + <set field="shippingContactMechId" from-field="parameters.shippingContactMechId"/> + </if-empty> + + <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml" + processor-name="person" in-map-name="parameters" out-map-name="personMap"/> + <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml" + processor-name="phoneNumber" in-map-name="parameters" out-map-name="phoneContext"/> + <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml" + processor-name="emailAddress" in-map-name="parameters" out-map-name="emailAddressContext"/> + <call-map-processor xml-resource="org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml" + processor-name="shipToAddress" in-map-name="parameters" out-map-name="shipToAddressContext"/> + <check-errors/> + + <!-- person and userLogin --> + <set-service-fields service-name="createPerson" map-name="personMap" to-map-name="personContext"/> + <set field="personContext.userLogin" from-field="userLogin"/> + <if-empty field="partyId"> + <call-service service-name="createPerson" in-map-name="personContext"> + <result-to-field result-name="partyId" field-name="partyId"/> + </call-service> + + <!-- the rest of the methods require a userLogin object; so if we are anonymous lets fake it --> + <if-empty field="userLogin"> + <set field="ulLookup.userLoginId" value="anonymous"/> + <find-by-primary-key entity-name="UserLogin" map-name="ulLookup" value-name="userLogin"/> + <set field="userLogin.partyId" from-field="partyId"/> + <set-current-user-login value-name="userLogin"/> + <else> + <!-- If an anonymous vistor is coming back, update the party id in the userLogin object --> + <if-compare field="userLogin.userLoginId" value="anonymous" operator="equals"> + <set field="userLogin.partyId" from-field="partyId"/> + </if-compare> + </else> + </if-empty> + <log level="info" message="userLogin is ${userLogin}"/> + + <!-- Party role --> + <set field="parameters.roleTypeId" value="CUSTOMER"/> + <set field="partyRoleContext.partyId" from-field="partyId"/> + <set field="partyRoleContext.roleTypeId" from-field="parameters.roleTypeId"/> + <set field="partyRoleContext.userLogin" from-field="userLogin"/> + <call-service service-name="createPartyRole" in-map-name="partyRoleContext"/> + <else><!-- If partyId already exists. --> + <set field="personContext.partyId" from-field="partyId"/> + <call-service service-name="updatePerson" in-map-name="personContext"/> + <log level="info" message="Party Updated partyId is ${partyId}"/> + </else> + </if-empty> + + <field-to-request field-name="partyId" request-name="partyId"/> + <field-to-request field-name="userLogin" request-name="userLogin"/> + <log level="info" message=" ${partyId}"/> + + <!-- 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"> + <set field="shipToAddressContext.contactMechPurposeTypeId" value="SHIPPING_LOCATION"/> + <call-service service-name="createPartyPostalAddress" in-map-name="shipToAddressContext"> + <result-to-field result-name="contactMechId" map-name="shipToAddressPurposeContext"/> + <result-to-field result-name="contactMechId" field-name="parameters.shippingContactMechId"/> + </call-service> + <log level="info" message="Shipping Postal Address created shippingContactMechId is ${parameters.shippingContactMechId}"></log> + <else> + <set field="shipToAddressContext.contactMechId" from-field="shippingContactMechId"/> + <call-service service-name="updatePartyPostalAddress" in-map-name="shipToAddressContext"> + <result-to-field result-name="contactMechId" field-name="parameters.shippingContactMechId"/> + </call-service> + <log level="info" message="Shipping Postal Address Updated shippingContactMechId is ${parameters.shippingContactMechId}"></log> + </else> + </if-empty> + <field-to-request field-name="parameters.shippingContactMechId" request-name="shippingContactMechId"/> + + <!-- Create or Update phone --> + <set field="phoneContext.partyId" from-field="partyId"/> + <set field="phoneContext.roleTypeId" from-field="parameters.roleTypeId"/> + <set field="phoneContext.userLogin" from-field="userLogin"/> + <if-empty field="parameters.phoneContactMechId"> + <set field="phoneContext.contactMechPurposeTypeId" value="PHONE_WORK"/> + <call-service service-name="createPartyTelecomNumber" in-map-name="phoneContext"> + <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/> + </call-service> + <log level="info" message="Phone Contact created phoneContactMechId is ${parameters.phoneContactMechId}"></log> + <else> + <set field="phoneContext.contactMechId" from-field="parameters.phoneContactMechId"/> + <log level="info" message="Updating phoneContactMechId is ${parameters.phoneContactMechId}"></log> + <call-service service-name="updatePartyTelecomNumber" in-map-name="phoneContext"> + <result-to-field result-name="contactMechId" field-name="parameters.phoneContactMechId"/> + </call-service> + <log level="info" message="Phone Contact updated phoneContactMechId is ${parameters.phoneContactMechId}"></log> + </else> + </if-empty> + <field-to-request field-name="parameters.phoneContactMechId" request-name="phoneContactMechId"/> + + <!-- Create Or Update email address --> + <set field="emailAddressContext.partyId" from-field="partyId"/> + <set field="emailAddressContext.userLogin" from-field="userLogin"/> + <if-empty field="parameters.emailContactMechId"> + <set field="emailAddressContext.contactMechPurposeTypeId" value="PRIMARY_EMAIL" /> + <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext"> + <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/> + </call-service> + <log level="info" message="Email Contact Created emailContactMechId is ${parameters.emailContactMechId}"></log> + <else> + <set field="emailAddressContext.contactMechId" from-field="parameters.emailContactMechId"/> + <!-- call update Email address --> + <call-service service-name="updatePartyEmailAddress" in-map-name="emailAddressContext"> + <result-to-field result-name="contactMechId" field-name="parameters.emailContactMechId"/> + </call-service> + <log level="info" message="Email Contact updated emailContactMechId is ${parameters.emailContactMechId}"></log> + </else> + </if-empty> + <field-to-request field-name="parameters.emailContactMechId" request-name="emailContactMechId"/> + + <!-- Set partyId, in shoppingCart --> + <call-object-method obj-field-name="shoppingCart" method-name="setUserLogin"> + <field field-name="userLogin" type="org.ofbiz.entity.GenericValue"/> + <field field-name="dispatcher" type="org.ofbiz.service.LocalDispatcher"/> + </call-object-method> + <call-object-method obj-field-name="shoppingCart" method-name="addContactMech"> + <string value="SHIPPING_LOCATION"/> + <field field-name="parameters.shippingContactMechId"/> + </call-object-method> + <call-object-method obj-field-name="shoppingCart" method-name="setShippingContactMechId"> + <field field-name="shippingContactMechId"/> + </call-object-method> + <log level="info" message="updated shopping cart shippingContactMechId ${parameters.shippingContactMechId}"/> + <call-object-method obj-field-name="shoppingCart" method-name="setOrderPartyId"> + <field field-name="partyId"/> + </call-object-method> + </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=672561&r1=672560&r2=672561&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Sat Jun 28 11:01:57 2008 @@ -31,6 +31,7 @@ <handler name="service-multi" type="request" class="org.ofbiz.webapp.event.ServiceMultiEventHandler"/> <handler name="simple" type="request" class="org.ofbiz.webapp.event.SimpleEventHandler"/> <handler name="rome" type="request" class="org.ofbiz.webapp.event.RomeEventHandler"/> + <handler name="jsonsimple" type="request" class="org.ofbiz.webapp.event.JSONSimpleEventHandler"/> <handler name="jsp" type="view" class="org.ofbiz.webapp.view.JspViewHandler"/> <handler name="http" type="view" class="org.ofbiz.webapp.view.HttpViewHandler"/> @@ -1581,7 +1582,14 @@ <response name="success" type="view" value="OnePageCheckout"/> <response name="error" type="view" value="main"/> </request-map> - + + <request-map uri="createUpdateShippingAddress"> + <security https="true" auth="false"/> + <event type="jsonsimple" path="org/ofbiz/ecommerce/customer/CustomerEvents.xml" invoke="createUpdateCustomerAndShippingContact"/> + <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=672561&r1=672560&r2=672561&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Sat Jun 28 11:01:57 2008 @@ -29,6 +29,7 @@ // Shipping Event.observe($('editShippingOptions'), 'click', function() { + processShippingAddress(); displayShippingOptionPanel(); }); @@ -91,6 +92,7 @@ function displayShippingOptionPanel() { if(!$('editShippingOptionPanel').visible()) { Effect.BlindDown('editShippingOptionPanel', {duration: 0.5}); + Effect.BlindDown('shippingCompleted', {duration: 0.5}); Effect.BlindUp('editCartPanel', {duration: 0.5}); Effect.BlindUp('editShippingPanel', {duration: 0.5}); Effect.BlindUp('editBillingPanel', {duration: 0.5}); @@ -102,6 +104,7 @@ Effect.Appear('billingSummaryPanel', {duration: 0.5}); //Effect.Appear('orderSubmitPanel', {duration: 0.5}); } + setDataInShippingCompleted(); } // Billing @@ -136,4 +139,44 @@ Effect.Appear('shippingOptionSummaryPanel', {duration: 0.5}); Effect.Appear('billingSummaryPanel', {duration: 0.5}); } +} + +function processShippingAddress() { + console.log('shippingForm' +$('shippingForm').serialize()); + new Ajax.Request('/ecommerce/control/createUpdateShippingAddress', { + asynchronous: true, + 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 { + // Process Shipping data response. + $('shippingPartyId').value = data.partyId; + $('shippingContactMechId').value = data.shippingContactMechId; + $('phoneContactMechId').value = data.phoneContactMechId; + $('emailContactMechId').value = data.emailContactMechId; + $('completedShippingMethod').update(data.shippingDescription); + } + }, parameters: $('shippingForm').serialize(), requestHeaders: {Accept: 'application/json'} + }); +} + +function setDataInShippingCompleted() { + console.log('calling the set method'); + var fullName = $('firstName').value + " " +$('lastName').value; + var shippingContactPhoneNumber = $F('shippingCountryCode')+ "-" + $F('shippingAreaCode') + + "-" + $F('shippingContactNumber')+ "-" + $F('shippingExtension'); + $('completedShipToAttn').update("Attn: " + fullName); + $('completedShippingContactNumber').update(shippingContactPhoneNumber); + $('completedEmailAddress').update($('emailAddress').value); + $('completedShipToAddress1').update($F('shipToAddress1')); + $('completedShipToAddress2').update($('shipToAddress2').value); + var shipToGeo = $('shipToCity').value+","+$('shipToStateProvinceGeoId').value +" "+$('shipToCountryGeoId').value+" "+$('shipToPostalCode').value; + $('completedShipToGeo').update(shipToGeo); } \ 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=672561&r1=672560&r2=672561&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Sat Jun 28 11:01:57 2008 @@ -44,14 +44,162 @@ <div class="screenlet-header"><div class="boxhead" align="left">Step 2: Shipping</div></div> <div id="shippingSummaryPanel"> <div align="left" style="width: auto; padding: 10px 40px 30px 40px;"><a href="javascript:void(0);" id="openShippingPanel"><h3>Click here to edit</h3></a></div> - <div id="shippingSummary" style="display: none;"> - Shipping Summary. + <div id="shippingSummary"><a href="javascript:void(0);" id="openShippingAndPersonlDetail"> + <h3>Shipping Summary</h3></a> + <div class="completed" style="display:none" id="shippingCompleted"> + <table cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td style=" padding: 6px; width: 60px;" valign="top">Ship To:</td> + <td style=" padding: 6px; width: 60px;" valign="top"> + <div> + <div id="completedShipToAttn"></div> + <div id="completedShippingContactNumber"></div> + <div id="completedEmailAddress"></div> + </div> + </td> + <td style=" padding: 6px; width: 60px;" valign="top">Location:</td> + <td style="padding: 6px; width: 60px;" valign="top"> + <div> + <div id="completedShipToAddress1"></div> + <div id="completedShipToAddress2"></div> + <div id="completedShipToGeo"></div> + </div> + </td> + </tr> + <tr><td colspan="10"><hr class="sepbar"/></td></tr> + </tbody> + </table> + </div> </div> </div> <div id="editShippingPanel" style="display: none;"> - <form name="shippingForm" id="shippingForm" action="<@ofbizUrl></@ofbizUrl>" method="post"> - Shipping Detail. - </form> + <form name="shippingForm" id="shippingForm" action="<@ofbizUrl>createUpdateCustomerAndShippingContact</@ofbizUrl>" method="post"> + <input type="hidden" id="shippingContactMechId" name="shippingContactMechId" value="${parameters.shippingContactMechId?if_exists}"/> + <input type="hidden" name="contactMechPurposeTypeId" value="SHIPPING_LOCATION"/> + <input type="hidden" id="shippingPartyId" name="partyId" value="${parameters.partyId?if_exists}"/> + <input type="hidden" name="userLogin" value="${parameters.userLogin?if_exists}"/> + <input type="hidden" id="phoneContactMechId" name="phoneContactMechId" value="${parameters.phoneContactMechId?if_exists}"/> + <input type="hidden" id="emailContactMechId" name="emailContactMechId" value="${parameters.emailContactMechId?if_exists}"/> + <div class="screenlet"> + <div class="screenlet-header"> + <div class='boxhead'> ${uiLabelMap.PartyNameAndShippingAddress}</div> + </div> + <div class="screenlet-body"> + <div class="theform validation-advice" id="shippingContactAndMethodTypeServerError"></div> + <table id="shippingTable"> + <tr><td> + <fieldset class="left"> + <div class="form-row"> + <div class="field-label"> + <label for="firstName1">${uiLabelMap.PartyFirstName}<span class="requiredLabel"> *</span><span id="advice-required-firstName" class="custom-advice" style="display:none">(required)</span></label> + </div> + <div class="field-widget"> + <input id="firstName" name="firstName" class="required" type="text" value="${parameters.firstName?if_exists}"/> + </div> + </div> + <div class="form-row"> + <div class="field-label"> + <label for="lastName1">${uiLabelMap.PartyLastName}<span class="requiredLabel"> *</span><span id="advice-required-lastName" class="custom-advice" style="display:none">(required)</span></label> + </div> + <div class="field-widget"> + <input id="lastName" name="lastName" class="required" type="text" value="${parameters.lastName?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="shippingCountryCode" 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-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="areaCode" class="input_mask mask_phone required validate-phone" id="shippingAreaCode" 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-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="contactNumber" class="input_mask mask_phone required validate-phone" id="shippingContactNumber" 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-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="extension" class="input_mask mask_phone required validate-phone" id="shippingExtension" value="${parameters.extension?if_exists}" size="3" maxlength=3> + </div> + </div> + <div class="form-row"> + <div class="field-label"> + <label for="emailAddress">${uiLabelMap.PartyEmailAddress}<span class="requiredLabel"> *</span><span id="advice-required-emailAddress" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-email-emailAddress" class="custom-advice" style="display:none">(required)</span></label> + </div> + <div class="field-widget"> + <input id="emailAddress" name="emailAddress" class="required validate-email" type="text" value="${parameters.emailAddress?if_exists}"/> + </div> + </div> + </fieldset> + <fieldset class="right"> + <div class="form-row"> + <div class="field-label"> + <label for="shipToAddress1">${uiLabelMap.FormFieldTitleStreetAddress}<span class="requiredLabel"> *</span><span id="advice-required-shipToAddress1" class="custom-advice" style="display:none">(required)</span><span id="advice-validate-no-po-address-shipToAddress1" class="custom-advice" style="display:none">(No PO or APO Address)</span></label> + </div> + <div class="field-widget"> + <input id="shipToAddress1" name="shipToAddress1" class="required validate-no-po-address" type="text" value="${parameters.shipToAddress1?if_exists}"/> + </div> + </div> + <div class="form-row"> + <div class="field-label"> + <label for="address2">${uiLabelMap.FormFieldTitleStreetAddress2}</label> + </div> + <div class="field-widget"> + <input id="shipToAddress2" name="shipToAddress2" type="text" value="${parameters.shipToAddress2?if_exists}" /> + </div> + </div> + <div class="form-row"> + <div class="field-label"> + <label for="city">${uiLabelMap.CommonCity}<span class="requiredLabel"> *</span><span id="advice-required-shipToCity" class="custom-advice" style="display:none">(required)</span></label> + </div> + <div class="field-widget"> + <input id="shipToCity" name="shipToCity" class="required" type="text" value="${parameters.shipToCity?if_exists}" /> + </div> + </div> + <div class="form-row"> + <div class="field-label"> + <label for="state">${uiLabelMap.CommonState}<span class="requiredLabel"> *</span></label> + </div> + <div class="field-label" style="clear:both;"> + <select class="required" id="shipToStateProvinceGeoId" name="shipToStateProvinceGeoId"> + <#if (parameters.shipToStateProvinceGeoId)?exists> + <option>${parameters.shipToStateProvinceGeoId}</option> + <option value="${parameters.shipToStateProvinceGeoId}"</option> + <#else> + <option value="CA">CA - California</option> + </#if> + ${screens.render("component://common/widget/CommonScreens.xml#states")} + </select> + </div> + </div> + <div class="form-row"> + <div class="field-label"> + <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}"/> + </div> + </div> + <div class="form-row"> + <div class="form-label">${uiLabelMap.PartyCountry}</div> + <div class="form-field"> + <select name="shipToCountryGeoId" id="shipToCountryGeoId" class="selectBox"> + <#if (parameters.shipToCountryGeoId)?exists> + <option>${parameters.shipToCountryGeoId}</option> + <option value="${parameters.shipToCountryGeoId}">---</option> + </#if> + ${screens.render("component://common/widget/CommonScreens.xml#countries")} + </select>* + </div> + </div> + </fieldset> + </td></tr> + </table> + </div> + </div> + </form> <div><h3><span class="editStep"><a href="javascript:void(0);" id="editShippingOptions"><h3>Continue for step 3</h3></a></span></h3></div> </div> </div> @@ -116,4 +264,4 @@ </div> </div> </div> - </div> \ No newline at end of file + </div> |
Free forum by Nabble | Edit this page |