Author: jonesde
Date: Thu Mar  5 21:07:30 2009
New Revision: 750587

URL: http://svn.apache.org/viewvc?rev=750587&view=rev
Log:
Small changes to have the additem request in ecommerce use the new view-last 
response type; this simplifies the templates quite a bit and will support 
staying on the same page anywhere without additional effort when adding to the 
cart; note that the view cart setting still works as it was a different 
response in ecommerce, and this doesn't effect the order manager which is made 
to always go back to the cart screen anyway and doesn't try to stay on the same 
page

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
    
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/productdetail.ftl
    
ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl

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=750587&r1=750586&r2=750587&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml 
(original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml 
Thu Mar  5 21:07:30 2009
@@ -238,7 +238,7 @@
     <request-map uri="additem">
         <security https="false" auth="false"/>
         <event type="java" 
path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addToCart"/>
-        <response name="success" type="view" value="showcart"/>
+        <response name="success" type="view-last" value="showcart"/>
         <response name="survey" type="view" value="survey"/>
         <response name="product" type="view" value="product"/>
         <response name="viewcart" type="request-redirect" value="showcart"/>

Modified: 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/productdetail.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/productdetail.ftl?rev=750587&r1=750586&r2=750587&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/productdetail.ftl 
(original)
+++ 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/productdetail.ftl 
Thu Mar  5 21:07:30 2009
@@ -417,7 +417,7 @@
             <div>&nbsp;</div>
       </#if>
 
-      <form method="post" action="<@ofbizUrl>additem<#if 
requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
 name="addform"  style="margin: 0;">
+      <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" 
name="addform"  style="margin: 0;">
         <#assign inStock = true>
         <#-- Variant Selection -->
         <#if product.isVirtual?if_exists?upper_case == "Y">
@@ -434,7 +434,6 @@
                 </select>
                 </div>
             </#list>
-              <input type="hidden" name="product_id" 
value="${product.productId}"/>
               <input type="hidden" name="add_product_id" 
value="${product.productId}"/>
             <div id="addCart1" style="display:none;>
               <span style="white-space: 
nowrap;"><b>${uiLabelMap.CommonQuantity}:</b></span>&nbsp;
@@ -458,21 +457,18 @@
                 </select>
               </div>
             </#list>
-            <input type="hidden" name="product_id" 
value="${product.productId}"/>
             <input type="hidden" name="add_product_id" value="NULL"/>
             <div>
               <b><span id="product_id_display"> </span></b>
               <b><div id="variant_price_display"> </div></b>
             </div>
           <#else>
-            <input type="hidden" name="product_id" 
value="${product.productId}"/>
             <input type="hidden" name="add_product_id" value="NULL"/>
             <div><b>${uiLabelMap.ProductItemOutOfStock}.</b></div>
             <#assign inStock = false>
           </#if>
          </#if> 
         <#else>
-          <input type="hidden" name="product_id" value="${product.productId}"/>
           <input type="hidden" name="add_product_id" 
value="${product.productId}"/>
           <#assign isStoreInventoryNotAvailable = 
!(Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryAvailable(request,
 product, 1.0))>
           <#assign isStoreInventoryRequired = 
Static["org.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryRequired(request,
 product)>
@@ -519,9 +515,6 @@
             <#-- This calls addItem() so that variants of virtual products 
cant be added before distinguishing features are selected, it should not be 
changed to additemSubmit() -->
             <a href="javascript:addItem()" class="buttontext"><span 
style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a>&nbsp;
           </#if>
-          <#if requestParameters.category_id?exists>
-            <input type="hidden" name="category_id" 
value="${requestParameters.category_id}"/>
-          </#if>
         </#if>
       </form>
     <div>

Modified: 
ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl?rev=750587&r1=750586&r2=750587&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl 
(original)
+++ 
ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl 
Thu Mar  5 21:07:30 2009
@@ -71,27 +71,17 @@
           <#elseif product.requireAmount?exists && product.requireAmount == 
"Y">
             <a href="${productUrl}" 
class="buttontext">${uiLabelMap.OrderChooseAmount}...</a>
           <#else>
-            <form method="post" action="<@ofbizUrl>additem<#if 
requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
 
name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}form"
 style="margin: 0;">
+            <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" 
name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}form"
 style="margin: 0;">
               <input type="hidden" name="add_product_id" 
value="${product.productId}"/>
               <input type="text" size="5" name="quantity" value="1"/>
-              <#if requestParameters.product_id?has_content><input 
type="hidden" name="product_id" value="${requestParameters.product_id}"/></#if>
-              <#if requestParameters.category_id?has_content><input 
type="hidden" name="category_id" 
value="${requestParameters.category_id}"/></#if>
-              <#if requestParameters.productPromoId?has_content><input 
type="hidden" name="productPromoId" 
value="${requestParameters.productPromoId}"/></#if>
-              <#if requestParameters.VIEW_INDEX?has_content><input 
type="hidden" name="VIEW_INDEX" value="${requestParameters.VIEW_INDEX}"/></#if>
-              <#if requestParameters.VIEW_SIZE?has_content><input 
type="hidden" name="VIEW_SIZE" value="${requestParameters.VIEW_SIZE}"/></#if>
               <input type="hidden" name="clearSearch" value="N"/>              
               <a 
href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}form.submit()"
 class="buttontext">${uiLabelMap.OrderAddToCart}</a>
             </form>
 
               <#if prodCatMem?exists && prodCatMem.quantity?exists && 0.00 < 
prodCatMem.quantity?double>
-                <form method="post" action="<@ofbizUrl>additem<#if 
requestAttributes._CURRENT_VIEW_?exists>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
 
name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform"
 style="margin: 0;">
+                <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" 
name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform"
 style="margin: 0;">
                   <input type="hidden" name="add_product_id" 
value="${prodCatMem.productId?if_exists}"/>
                   <input type="hidden" name="quantity" 
value="${prodCatMem.quantity?if_exists}"/>
-                  <#if requestParameters.product_id?has_content><input 
type="hidden" name="product_id" value="${requestParameters.product_id}"/></#if>
-                  <#if requestParameters.category_id?has_content><input 
type="hidden" name="category_id" 
value="${requestParameters.category_id}"/></#if>
-                  <#if requestParameters.productPromoId?has_content><input 
type="hidden" name="productPromoId" 
value="${requestParameters.productPromoId}"/></#if>
-                  <#if requestParameters.VIEW_INDEX?has_content><input 
type="hidden" name="VIEW_INDEX" value="${requestParameters.VIEW_INDEX}"/></#if>
-                  <#if requestParameters.VIEW_SIZE?has_content><input 
type="hidden" name="VIEW_SIZE" value="${requestParameters.VIEW_SIZE}"/></#if>
                   <input type="hidden" name="clearSearch" value="N"/>
                   <a 
href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform.submit()"
 
class="buttontext">${uiLabelMap.CommonAddDefault}(${prodCatMem.quantity?string.number})
 ${uiLabelMap.OrderToCart}</a>
                 </form>


Reply via email to