You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2011/09/22 09:35:09 UTC

svn commit: r1173975 - in /ofbiz/trunk/specialpurpose/ecommerce: webapp/ecommerce/order/OnePageCheckoutProcess.ftl widget/OrderScreens.xml

Author: sascharodekamp
Date: Thu Sep 22 07:35:09 2011
New Revision: 1173975

URL: http://svn.apache.org/viewvc?rev=1173975&view=rev
Log:
OnePageCheckout should reuse UpdateCart while first time rendering (https://issues.apache.org/jira/browse/OFBIZ-4436) A patch from Kiran Gawde which reuses the UpdateCart Screen in the OnePageCheckout to avoid code duplication.

Modified:
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
    ofbiz/trunk/specialpurpose/ecommerce/widget/OrderScreens.xml

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl?rev=1173975&r1=1173974&r2=1173975&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Thu Sep 22 07:35:09 2011
@@ -25,171 +25,7 @@ under the License.
 
 <#-- ========================================================================================================================== -->
         <div id="cartPanel" class="screenlet">
-          <h3>${uiLabelMap.EcommerceStep} 1: ${uiLabelMap.PageTitleShoppingCart}</h3>
-          <div id="cartSummaryPanel" style="display: none;">
-            <a href="javascript:void(0);" id="openCartPanel" class="button">${uiLabelMap.EcommerceClickHereToEdit}</a>
-            <table id="cartSummaryPanel_cartItems" summary="This table displays the list of item added into Shopping Cart.">
-              <thead>
-                <tr>
-                  <th id="orderItem">${uiLabelMap.OrderItem}</th>
-                  <th id="description">${uiLabelMap.CommonDescription}</th>
-                  <th id="unitPrice">${uiLabelMap.EcommerceUnitPrice}</th>
-                  <th id="quantity">${uiLabelMap.OrderQuantity}</th>
-                  <th id="adjustment">${uiLabelMap.EcommerceAdjustments}</th>
-                  <th id="itemTotal">${uiLabelMap.EcommerceItemTotal}</th>
-                </tr>
-              </thead>
-              <tfoot>
-                <tr id="completedCartSubtotalRow">
-                  <th id="subTotal" scope="row" colspan="5">${uiLabelMap.CommonSubtotal}</th>
-                  <td headers="subTotal" id="completedCartSubTotal"><@ofbizCurrency amount=shoppingCart.getSubTotal() isoCode=shoppingCart.getCurrency() /></td>
-                </tr>
-                <#assign orderAdjustmentsTotal = 0 />
-                <#list shoppingCart.getAdjustments() as cartAdjustment>
-                  <#assign orderAdjustmentsTotal = orderAdjustmentsTotal + Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustment(cartAdjustment, shoppingCart.getSubTotal()) />
-                </#list>
-                <tr id="completedCartDiscountRow">
-                  <th id="productDiscount" scope="row" colspan="5">${uiLabelMap.ProductDiscount}</th>
-                  <td headers="productDiscount" id="completedCartDiscount"><input type="hidden" value="${orderAdjustmentsTotal}" id="initializedCompletedCartDiscount" /><@ofbizCurrency amount=orderAdjustmentsTotal isoCode=shoppingCart.getCurrency() /></td>
-                </tr>
-                <tr>
-                  <th id="shippingAndHandling" scope="row" colspan="5">${uiLabelMap.OrderShippingAndHandling}</th>
-                  <td headers="shippingAndHandling" id="completedCartTotalShipping"><@ofbizCurrency amount=shoppingCart.getTotalShipping() isoCode=shoppingCart.getCurrency() /></td>
-                </tr>
-                <tr>
-                  <th id="salesTax" scope="row" colspan="5">${uiLabelMap.OrderSalesTax}</th>
-                  <td headers="salesTax" id="completedCartTotalSalesTax"><@ofbizCurrency amount=shoppingCart.getTotalSalesTax() isoCode=shoppingCart.getCurrency() /></td>
-                </tr>
-                <tr>
-                  <th id="grandTotal" scope="row" colspan="5">${uiLabelMap.OrderGrandTotal}</th>
-                  <td headers="grandTotal" id="completedCartDisplayGrandTotal"><@ofbizCurrency amount=shoppingCart.getDisplayGrandTotal() isoCode=shoppingCart.getCurrency() /></td>
-                </tr>
-              </tfoot>
-              <tbody>
-                <#list shoppingCart.items() as cartLine>
-                  <#if cartLine.getProductId()?exists>
-                    <#if cartLine.getParentProductId()?exists>
-                      <#assign parentProductId = cartLine.getParentProductId() />
-                    <#else>
-                      <#assign parentProductId = cartLine.getProductId() />
-                    </#if>
-                    <#assign smallImageUrl = Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(cartLine.getProduct(), "SMALL_IMAGE_URL", locale, dispatcher)?if_exists />
-                    <#if !smallImageUrl?string?has_content><#assign smallImageUrl = "" /></#if>
-                  </#if>
-                  <tr id="cartItemDisplayRow_${cartLine_index}">
-                    <td headers="orderItem"><img src="<@o...@ofbizContentUrl>" alt = "Product Image" /></td>
-                    <td headers="description">${cartLine.getName()?if_exists}</td>
-                    <td headers="unitPrice" id="completedCartItemPrice_${cartLine_index}">${cartLine.getDisplayPrice()}</td>
-                    <td headers="quantity"><span id="completedCartItemQty_${cartLine_index}">${cartLine.getQuantity()?string.number}</span></td>
-                    <td headers="adjustment"><span id="completedCartItemAdjustment_${cartLine_index}"><@ofbizCurrency amount=cartLine.getOtherAdjustments() isoCode=shoppingCart.getCurrency() /></span></td>
-                    <td headers="itemTotal" align="right"><span id="completedCartItemSubTotal_${cartLine_index}"><@ofbizCurrency amount=cartLine.getDisplayItemSubTotal() isoCode=shoppingCart.getCurrency() /></span></td>
-                  </tr>
-                </#list>
-              </tbody>
-            </table>
-          </div>
-
-<#-- ============================================================= -->
-          <div id="editCartPanel">
-            <form id="cartForm" method="post" action="<@o...@ofbizUrl>">
-                <fieldset>
-                  <input type="hidden" name="removeSelected" value="false" />
-                  <div id="cartFormServerError" class="errorMessage"></div>
-                  <table id="editCartPanel_cartItems">
-                    <thead>
-                      <tr>
-                        <th id="editOrderItem">${uiLabelMap.OrderItem}</th>
-                        <th id="editDescription">${uiLabelMap.CommonDescription}</th>
-                        <th id="editUnitPrice">${uiLabelMap.EcommerceUnitPrice}</th>
-                        <th id="editQuantity">${uiLabelMap.OrderQuantity}</th>
-                        <th id="editAdjustment">${uiLabelMap.EcommerceAdjustments}</th>
-                        <th id="editItemTotal">${uiLabelMap.EcommerceItemTotal}</th>
-                        <th id="removeItem">${uiLabelMap.FormFieldTitle_removeButton}</th>
-                      </tr>
-                    </thead>
-                    <tfoot>
-                      <tr>
-                        <th scope="row" colspan="6">${uiLabelMap.CommonSubtotal}</th>
-                        <td id="cartSubTotal"><@ofbizCurrency amount=shoppingCart.getSubTotal() isoCode=shoppingCart.getCurrency() /></td>
-                      </tr>
-                      <tr>
-                        <th scope="row" colspan="6">${uiLabelMap.ProductDiscount}</th>
-                        <td id="cartDiscountValue">
-                            <#assign orderAdjustmentsTotal = 0  />
-                            <#list shoppingCart.getAdjustments() as cartAdjustment>
-                              <#assign orderAdjustmentsTotal = orderAdjustmentsTotal + Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustment(cartAdjustment, shoppingCart.getSubTotal()) />
-                            </#list>
-                            <@ofbizCurrency amount=orderAdjustmentsTotal isoCode=shoppingCart.getCurrency() />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th scope="row" colspan="6">${uiLabelMap.OrderShippingAndHandling}</th>
-                        <td id="cartTotalShipping"><@ofbizCurrency amount=shoppingCart.getTotalShipping() isoCode=shoppingCart.getCurrency() /></td>
-                      </tr>
-                      <tr>
-                        <th scope="row" colspan="6">${uiLabelMap.OrderSalesTax}</th>
-                        <td id="cartTotalSalesTax"><@ofbizCurrency amount=shoppingCart.getTotalSalesTax() isoCode=shoppingCart.getCurrency() /></td>
-                      </tr>
-                      <tr>
-                        <th scope="row" colspan="6">${uiLabelMap.OrderGrandTotal}</th>
-                        <td id="cartDisplayGrandTotal"><@ofbizCurrency amount=shoppingCart.getDisplayGrandTotal() isoCode=shoppingCart.getCurrency() /></td>
-                      </tr>
-                    </tfoot>
-                    <tbody id="updateBody">
-                      <#list shoppingCart.items() as cartLine>
-                        <tr id="cartItemRow_${cartLine_index}">
-                          <td headers="editOrderItem">
-                            <#if cartLine.getProductId()?exists>
-                              <#if cartLine.getParentProductId()?exists>
-                                <#assign parentProductId = cartLine.getParentProductId() />
-                              <#else>
-                                <#assign parentProductId = cartLine.getProductId() />
-                              </#if>
-                              <#assign smallImageUrl = Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(cartLine.getProduct(), "SMALL_IMAGE_URL", locale, dispatcher)?if_exists />
-                              <#if !smallImageUrl?string?has_content><#assign smallImageUrl = "" /></#if>
-                              <#if smallImageUrl?string?has_content>
-                                <img src="<@o...@ofbizContentUrl>" alt="Product Image" />
-                              </#if>
-                            </#if>
-                          </td>
-                          <td headers="editDescription">${cartLine.getName()?if_exists}</td>
-                          <td headers="editUnitPrice" id="itemUnitPrice_${cartLine_index}"><@ofbizCurrency amount=cartLine.getDisplayPrice() isoCode=shoppingCart.getCurrency() /></td>
-                          <td headers="editQuantity">
-                            <#if cartLine.getIsPromo()>
-                              ${cartLine.getQuantity()?string.number}
-                            <#else>
-                              <input type="hidden" name="cartLineProductId" id="cartLineProductId_${cartLine_index}" value="${cartLine.getProductId()}" />
-                              <input type="text" name="update${cartLine_index}" id="qty_${cartLine_index}" value="${cartLine.getQuantity()?string.number}" class="required validate-number" />
-                              <span id="advice-required-qty_${cartLine_index}" style="display:none;" class="errorMessage"> (${uiLabelMap.CommonRequired})</span>
-                              <span id="advice-validate-number-qty_${cartLine_index}" style="display:none;" class="errorMessage"> (${uiLabelMap.CommonPleaseEnterValidNumberInThisField}) </span>
-                            </#if>
-                          </td>
-                          <#if !cartLine.getIsPromo()>
-                            <td headers="editAdjustment" id="addPromoCode_${cartLine_index}"><@ofbizCurrency amount=cartLine.getOtherAdjustments() isoCode=shoppingCart.getCurrency() /></td>
-                          <#else>
-                            <td headers="editAdjustment"><@ofbizCurrency amount=cartLine.getOtherAdjustments() isoCode=shoppingCart.getCurrency() /></td>
-                          </#if>
-                          <td headers="editItemTotal" id="displayItem_${cartLine_index}"><@ofbizCurrency amount=cartLine.getDisplayItemSubTotal() isoCode=shoppingCart.getCurrency() /></td>
-                          <#if !cartLine.getIsPromo()>
-                            <td><a id="removeItemLink_${cartLine_index}" href="javascript:void(0);"><img id="remove_${cartLine_index}" src="<@o...@ofbizContentUrl>" alt="Remove Item Image" /></a></td>
-                          </#if>
-                        </tr>
-                      </#list>
-                    </tbody>
-                  </table>
-                  </fieldset>
-                  <fieldset id="productPromoCodeFields">
-                    <div>
-                      <label for="productPromoCode">${uiLabelMap.EcommerceEnterPromoCode}</label>
-                      <input id="productPromoCode" name="productPromoCode" type="text" value="" />
-                    </div>
-                  </fieldset>
-                <fieldset>
-                  <a href="javascript:void(0);" class="button" id="updateShoppingCart" >${uiLabelMap.EcommerceContinueToStep} 2</a>
-                  <a style="display: none" class="button" href="javascript:void(0);" id="processingShipping">${uiLabelMap.EcommercePleaseWait}....</a>
-                </fieldset>
-            </form>
-          </div>
+          ${screens.render("component://ecommerce/widget/CartScreens.xml#UpdateCart")}
         </div>
 
 <#-- ========================================================================================================================== -->

Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/OrderScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/OrderScreens.xml?rev=1173975&r1=1173974&r2=1173975&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/widget/OrderScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/widget/OrderScreens.xml Thu Sep 22 07:35:09 2011
@@ -613,7 +613,6 @@ under the License.
                 <set field="titleProperty" value="EcommerceOnePageCheckout"/>
                 <set field="layoutSettings.javaScripts[]" value="/ecommerce/images/checkoutProcess.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/ordermgr/images/js/geoAutoCompleter.js" global="true"/>
-                <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy"/>
                 <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditShippingAddress.groovy"/>
                 <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditBillingAddress.groovy"/>
                 <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditEmailAndTelecomNumber.groovy"/>