Author: mor
Date: Mon Aug 11 06:35:50 2008
New Revision: 684743

URL: http://svn.apache.org/viewvc?rev=684743&view=rev
Log:
Improvent in one page checkout events. Patch from Mridul Pathak and Sumit 
Pandit.

Modified:
    
ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.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/CustomerEvents.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?rev=684743&r1=684742&r2=684743&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
 Mon Aug 11 06:35:50 2008
@@ -862,8 +862,15 @@
             <session-to-field field-name="shoppingCart"/>
         </if-empty>
 
+        <if-not-empty field="partyId">
+            <!-- If userLogin is empty set anonymous userLogin or if anonymous 
user is coming back update userLogin -->
+            <call-simple-method method-name="setAnonUserLogin"/>
+        </if-not-empty>
         <call-simple-method method-name="createUpdatePerson"/>
-        <call-simple-method method-name="setAnonUserLogin"/>
+        <if-empty field="userLogin">
+            <!-- If new anonymous user set anonymous userLogin -->
+            <call-simple-method method-name="setAnonUserLogin"/>
+        </if-empty>
         
         <set field="partyRoleContext.partyId" from-field="partyId"/>
         <set field="partyRoleContext.roleTypeId" 
from-field="parameters.roleTypeId"/>
@@ -982,7 +989,6 @@
         </else>
         </if-empty>
         <field-to-request field-name="userLogin" request-name="userLogin"/>
-        <field-to-session field-name="userLogin" session-name="userLogin"/>
         <log level="info" message="userLogin is ${userLogin}"/>
     </simple-method>
 
@@ -1210,25 +1216,36 @@
     </simple-method>
 
     <simple-method method-name="createUpdateBillingAndPayment" 
short-description="Create/update billing address and payment information" 
login-required="false">
+        <set field="partyId" from-field="parameters.partyId"/>
+        <if-not-empty field="userLogin">
+            <if-empty field="partyId">
+                <set field="partyId" from-field="userLogin.partyId"/>
+            </if-empty>
+        </if-not-empty>
         <set field="shoppingCart" from-field="parameters.shoppingCart"/>
         <set field="parameters.billToCountryGeoId" 
from-field="parameters.countryGeoId"/>
+        <set field="shipToContactMechId" 
from-field="parameters.shipToContactMechId"/>
         <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="shipToContactMechId"/>
-        <else>
-            <set field="partyId" from-field="parameters.partyId"/>
-            <session-to-field field-name="userLogin"/>
+            <if-empty field="partyId">
+                <call-object-method obj-field-name="shoppingCart" 
method-name="getPartyId" ret-field-name="partyId"/>
+            </if-empty>
             <if-empty field="userLogin">
-                <set field="userLogin" from-field="parameters.userLogin"/>
+                <call-object-method obj-field-name="shoppingCart" 
method-name="getUserLogin" ret-field-name="userLogin"/>
+                <if-not-empty field="userLogin">
+                    <set-current-user-login value-name="userLogin"/>
+                </if-not-empty>
             </if-empty>
-            <set field="shipToContactMechId" 
from-field="parameters.shipToContactMechId"/>
-        </else>
+            <if-empty field="shipToContactMechId">
+                <call-object-method obj-field-name="shoppingCart" 
method-name="getShippingContactMechId" ret-field-name="shipToContactMechId"/>
+            </if-empty>
+        </if-not-empty>
+        <if-not-empty field="partyId">
+            <!-- If userLogin is empty set anonymous userLogin or if anonymous 
user is coming back update userLogin -->
+            <call-simple-method method-name="setAnonUserLogin"/>
         </if-not-empty>
-        <set-current-user-login value-name="userLogin"/>
 
         <call-simple-method method-name="createUpdateBillingAddress"/>
         <call-simple-method method-name="createUpdateCreditCard"/>

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=684743&r1=684742&r2=684743&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js 
(original)
+++ 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js 
Mon Aug 11 06:35:50 2008
@@ -235,7 +235,8 @@
                 Effect.Fade('shippingFormServerError');
                 isShipStepValidate = true;
                 // Process Shipping data response.
-                $('shippingPartyId').value = data.partyId;
+                $('shipToPartyId').value = data.partyId;
+                $('billToPartyId').value = data.partyId;
                 $('shipToContactMechId').value = data.shipToContactMechId;
                 $('phoneContactMechId').value = data.phoneContactMechId;
                 $('emailContactMechId').value = data.emailContactMechId;
@@ -373,6 +374,7 @@
     var billToGeo = $F('billToCity')+","+$F('billToStateProvinceGeoId') +" 
"+$F('billToCountryGeoId')+" "+$F('billToPostalCode');
     $('completedBillToGeo').update(billToGeo);
     $('paymentMethod').update($F('paymentMethodTypeId'));
+    $('billToContactMechIdInShipingForm').value = $F('billToContactMechId');
 }
 
 function initCartProcessObservers() {

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=684743&r1=684742&r2=684743&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
 (original)
+++ 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
 Mon Aug 11 06:35:50 2008
@@ -243,8 +243,8 @@
           <div id="editShippingPanel" class="screenlet-body" style="display: 
none;">
             <form name="shippingForm" id="shippingForm" 
action="<@ofbizUrl>createUpdateShippingAddress</@ofbizUrl>" method="post">
               <input type="hidden" id="shipToContactMechId" 
name="shipToContactMechId" value="${parameters.shipToContactMechId?if_exists}"/>
-              <input type="hidden" name="billToContactMechId" 
value="${parameters.billToContactMechId?if_exists}"/>
-              <input type="hidden" id="shippingPartyId" name="partyId" 
value="${parameters.partyId?if_exists}"/>
+              <input type="hidden" id="billToContactMechIdInShipingForm" 
name="billToContactMechId" value="${parameters.billToContactMechId?if_exists}"/>
+              <input type="hidden" id="shipToPartyId" name="partyId" 
value="${parameters.partyId?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}"/>
               <input type="hidden" name="roleTypeId" value="CUSTOMER"/>
@@ -433,8 +433,7 @@
               <input type="hidden" id="shipToContactMechIdInBillingForm" 
name="shipToContactMechId" value="${parameters.shipToContactMechId?if_exists}"/>
               <input type="hidden" id="paymentMethodId" name="paymentMethodId" 
value="${parameters.paymentMethodId?if_exists}"/>
               <input type="hidden" id="paymentMethodTypeId" 
name="paymentMethodTypeId" value="${parameters.paymentMethodTypeId?if_exists}"/>
-              <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" id="billToPartyId" name="partyId" 
value="${parameters.partyId?if_exists}"/>
               <input type="hidden" name="expireDate" 
value="${parameters.expireDate?if_exists}"/>
               <input type="hidden" name="roleTypeId" value="CUSTOMER"/>
               <div id="billingFormServerError" class="errorMessage"></div>


Reply via email to