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/08 11:28:25 UTC

svn commit: r674748 - in /ofbiz/trunk/applications/ecommerce/webapp/ecommerce: images/checkoutProcess.js order/OnePageCheckoutProcess.ftl

Author: mor
Date: Tue Jul  8 02:28:24 2008
New Revision: 674748

URL: http://svn.apache.org/viewvc?rev=674748&view=rev
Log:
Validation at Step 1 (Shopping Cart) on One Page 

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl

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=674748&r1=674747&r2=674748&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Tue Jul  8 02:28:24 2008
@@ -19,8 +19,13 @@
  
 Event.observe(window, 'load', function() {
 	// Cart
+    var isCartStepValidate = false;
+    var validateCart = new Validation('cartForm', {immediate: true, onSubmit: false});	
     Event.observe($('editShipping'), 'click', function() {
-        displayShippingPanel();
+        if (validateCart.validate()) {
+            displayShippingPanel();
+            isCartStepValidate = true;
+        }
     });
 
     Event.observe($('openCartPanel'), 'click', function() {
@@ -327,12 +332,12 @@
     var elementId = qtyElement.id;
     var productIdElementId = elementId.sub('qty_', 'cartLineProductId_');
     var productId = $(productIdElementId).value;
-    if (qtyElement.value >= 0) {
-        if ((event.keyCode > 47 && event.keyCode < 58) || (event.keyCode > 95 && event.keyCode < 106)) {
-            var itemIndex = getProductLineItemIndex(event, productId);
-            var formValues = $('cartForm').serialize();
-            updateCartData(elementId, formValues, qtyElement.value, itemIndex);
-        }
+    if (qtyElement.value >= 0 && !isNaN(qtyElement.value)) {
+        var itemIndex = getProductLineItemIndex(event, productId);
+        var formValues = $('cartForm').serialize();
+        updateCartData(elementId, formValues, qtyElement.value, itemIndex);
+    } else {
+    	qtyElement.value = "";	
     }
 }
 

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=674748&r1=674747&r2=674748&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Tue Jul  8 02:28:24 2008
@@ -157,8 +157,15 @@
                                     ${cartLine.getQuantity()?string.number}
                                   <#else>
                                     <input type="hidden" name="cartLineProductId" id="cartLineProductId_${cartLineIndex}" value="${cartLine.getProductId()}">
-                                    <input size="2" id="qty_${cartLineIndex}" type="text" name="update_${cartLineIndex}" value="${cartLine.getQuantity()?string.number}">
-                                  </#if> 
+                                    <div>
+                                      <label for="qty_${cartLineIndex}">
+                                        <span id="advice-required-qty_${cartLineIndex}" style="display:none;">Quantity required.</span>
+                                      </label>
+                                      <span>
+                                        <input type="text" name="update_${cartLineIndex}" id="qty_${cartLineIndex}" value="${cartLine.getQuantity()?string.number}" size="2" class="required validate-number"><span>*</span>
+                                      </span>
+                                    </div>
+                                  </#if>
                                 </td>
                                 <#if cartLine.getIsPromo()>
                                   <td  style="padding: 6px;" align="center" valign="top">FREE</td>
@@ -645,19 +652,21 @@
       </#if>
 
       <div id="emptyCartCheckoutPanel" align="center" <#if shoppingCart?has_content && shoppingCart.size() gt 0> style="display: none; border: 1px solid #333333; height: auto;"</#if>>
-        <div>${uiLabelMap.OrderCheckout}</div>
         <div>
-          <div><span style="display: none"><a href="javascript:void(0);"><img src="<@o...@ofbizContentUrl>"></a></span></div>
-          <div>STEP 1: Confirm Totals</div><br>
+          <div class="screenlet-header"><div class="boxhead" align="left">Step 1: ${uiLabelMap.PageTitleShoppingCart}</div></div><br/>
           <div>You currently have no items in your cart. Click <a href="<@o...@ofbizUrl>">here</a> to view our products.</div>
-        </div>
+        </div><br/>
         <div>
-          <div><span style="display: none"><a href="javascript:void(0);"><img src="<@o...@ofbizContentUrl>"></a></span></div>
-          <div>STEP 2: Shipping</div>
-        </div>
+          <div class="screenlet-header"><div class="boxhead" align="left">Step 2: Shipping</div></div>
+        </div><br/>
+        <div>
+          <div class="screenlet-header"><div class="boxhead" align="left">Step 3: Shipping Options</div></div>
+        </div><br/>
+        <div>
+          <div class="screenlet-header"><div class="boxhead" align="left">Step 4: Billing</div></div>
+        </div><br/>
         <div>
-          <div><span style="display: none"><a href="javascript:void(0);"><img src="<@o...@ofbizContentUrl>"></a></span></div>
-          <div>STEP 3: Billing</div>          
+          <div class="screenlet-header"><div class="boxhead" align="left">Step 5: Submit Order</div></div>
         </div>
       </div>
     </div>