Author: mor
Date: Thu Jul 10 23:55:10 2008 New Revision: 675841 URL: http://svn.apache.org/viewvc?rev=675841&view=rev Log: Applied patch (for promotion on One Page Checkout) from Jira Issue OFBIZ-1872 (https://issues.apache.org/jira/browse/OFBIZ-1872). Thanks Brajesh Patel for your efforts ... Modified: ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.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=675841&r1=675840&r2=675841&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.xml (original) +++ ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.xml Thu Jul 10 23:55:10 2008 @@ -1451,6 +1451,9 @@ <value xml:lang="th">à¸à¸°à¸à¸£à¹à¸²à¸§à¹à¸²à¸à¹à¸à¸¥à¹à¸²</value> <value xml:lang="zh">æ¸ ç©ºè´ç©è½¦</value> </property> + <property key="EcommerceEnterPromoCode"> + <value xml:lang="en">Enter Promo Code</value> + </property> <property key="EcommerceEnterQueryParameters"> <value xml:lang="en">Enter Query Parameters</value> <value xml:lang="es">Ingrese parámetros de búsqueda</value> 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=675841&r1=675840&r2=675841&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Thu Jul 10 23:55:10 2008 @@ -1612,7 +1612,12 @@ <response name="success" type="request" value="getCartData"/> <response name="error" type="request" value="getCartData"/> </request-map> - + <request-map uri="silentAddPromoCode"> + <security https="true" auth="false"/> + <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addProductPromoCode"/> + <response name="success" type="request" value="getCartData"/> + <response name="error" type="request" value="getCartData"/> + </request-map> <request-map uri="getCartData"> <security https="true" auth="false"/> <event type="jsonservice" invoke="getShoppingCartData"/> 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=675841&r1=675840&r2=675841&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Thu Jul 10 23:55:10 2008 @@ -324,16 +324,62 @@ } function initCartProcessObservers() { - var cartFormElement = $('cartForm'); - var inputs = cartFormElement.getInputs('text'); - inputs.each( function(e) { - Event.observe(e, 'keyup', cartItemQtyChanged); + var cartForm = $('cartForm'); + Event.observe($('productPromoCode'), 'change', addPromoCode); + var inputs = cartForm.getInputs('text'); + inputs.each(function(e) { + if(e.id != 'productPromoCode') { + Event.observe(e, 'keyup', cartItemQtyChanged); + } }); - var removeLinks = cartFormElement.getElementsByTagName('a'); + var removeLinks = cartForm.getElementsByTagName('a'); var links = $A(removeLinks); links.each( function(e) { Event.observe(e, 'click', removeItem); }); + if ($('initializedCompletedCartDiscount') != undefined && $('initializedCompletedCartDiscount').value == 0) { + $('completedCartDiscountRow').hide(); + } +} + +function addPromoCode() { + new Ajax.Request('/ecommerce/control/silentAddPromoCode', { + asynchronous: false, + onSuccess: function(transport) { + var data = transport.responseText.evalJSON(true); + if (data._ERROR_MESSAGE_LIST_ != undefined) { + $('cartFormServerError').update(data._ERROR_MESSAGE_LIST_); + } else if (data._ERROR_MESSAGE_ != undefined) { + $('cartFormServerError').update(data._ERROR_MESSAGE_); + } else { + $('cartDiscountValue').update(data.displayDiscountTotalCurrencyFormatted); + $('cartSubTotal').update(data.subTotalCurrencyFormatted); + $('cartTotalShipping').update(data.totalShippingCurrencyFormatted); + $('cartTotalSalesTax').update(data.totalSalesTaxCurrencyFormatted); + $('cartDisplayGrandTotal').update(data.displayGrandTotalCurrencyFormatted); + // update summary + $('completedCartSubTotal').update(data.subTotalCurrencyFormatted); + $('completedCartTotalShipping').update(data.totalShippingCurrencyFormatted); + $('completedCartTotalSalesTax').update(data.totalSalesTaxCurrencyFormatted); + $('completedCartDisplayGrandTotal').update(data.displayGrandTotalCurrencyFormatted); + $('completedCartDiscount').update(data.displayDiscountTotalCurrencyFormatted); + if (data.displayDiscountTotal < 0) { + $('completedCartDiscountRow').show(); + } else { + $('completedCartDiscountRow').hide(); + } + if (elementId !=undefined ) { + if ($(elementId).value == 0) { + var cartItemRowId = elementId.sub('qty_','cartItemRow_'); + $(cartItemRowId).remove(); + var cartItemDisplayRowId = elementId.sub('qty_','cartItemDisplayRow_'); + $(cartItemDisplayRowId).remove(); + } + } + } + }, + parameters: {productPromoCodeId:$F('productPromoCode')} + }); } function getProductLineItemIndex(event, productId) { 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=675841&r1=675840&r2=675841&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Thu Jul 10 23:55:10 2008 @@ -111,6 +111,7 @@ <div id="editCartPanel" class="screenlet-body"> <form name="cartForm" id="cartForm" method="post" action="<@ofbizUrl></@ofbizUrl>"> <input type="hidden" name="removeSelected" value="false"> + <div id="cartFormServerError"></div> <table width="75%" cellspacing="0" cellpadding="1" border="0"> <thead> <tr> @@ -183,7 +184,11 @@ <td><div id="cartSubTotal" align="center"><@ofbizCurrency amount=initializedSubTotal isoCode=shoppingCart.getCurrency()/></div></td> </tr> <tr> - <td colspan="3"></td> + <td colspan="3"> + <div>${uiLabelMap.EcommerceEnterPromoCode}: + <input id="productPromoCode" class="inputBox" name="productPromoCode" size="22" type="text" value=""/> + </div> + </td> <td><div id="cartDiscount" align="right"><b>${uiLabelMap.ProductDiscount}:</b></div></td> <td> <div id="cartDiscountValue" align="center"><@ofbizCurrency amount=shoppingCart.getProductPromoTotal() isoCode=shoppingCart.getCurrency()/></div> |
Free forum by Nabble | Edit this page |