Login  Register

Re: [OFBiz] Users - OrderEntry Website and Multiple Product Stores

Posted by Jacopo Cappellato on Aug 11, 2005; 6:12am
URL: http://ofbiz.116.s1.nabble.com/OFBiz-Users-OrderEntry-Website-and-Multiple-Product-Stores-tp135368p135369.html

Kyle,

the patch is attached.
September 2004... a lot is changed since then in the order entry: good
luck! Probably you'll need to apply all the mods to the showcart.bsh: if
I well remember it was there that all the init was done.

Jacopo


Kyle Tippetts wrote:
 > That's great. Can you tell me which files were involved with the patch?
 > I'll download the latest SVN snapshot, but I'm going to need to try and
 > patch my September 2004 production version as well, and I think it'd be
 > better for me to just patch the specific class methods or whatever.
 >
 > Thanks for all your work on this. I really appreciate it.
 >
 > --Kyle
 >
 > On Wed, 2005-08-10 at 18:24 +0200, Jacopo Cappellato wrote:
 >
 >>Hi Kyle,
 >>
 >>I've committed a patch (rev 5499) that should fix the bug: please, could
 >>you do a few tests and let me know if everything is ok?
 >>
 >>Thanks,
 >>
 >>Jacopo
 >>
 >>Kyle Tippetts wrote:
 >>
 >>>I'm preparing to enter this as an issue in JIRA, since it appears that
 >>>this doesn't work in the latest SVN version either. I just want to make
 >>>sure that the behaviour I expect from the Order Entry Website is what's
 >>>really supposed to happen.
 >>>
 >>>If I select a product store from the drop-down list on the first Order
 >>>Entry page, I expect that the Browse Categories box should only show the
 >>>Catalog Categories for the selected product store, and whatever order
 >>>number is generated, it should include any Order Number Prefix that's
 >>>been set up for the selected product store.
 >>>
 >>>Thanks,
 >>>--Kyle
 >>>

Author: jacopo
Date: 2005-08-10 11:21:02 -0500 (Wed, 10 Aug 2005)
New Revision: 5499

Modified:
   trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh
Log:
This patch will manage properly the session variables "productStoreId" and "CURRENT_CATALOG_ID" to avoid problems
in order entry when you switch from a product store to another. Thanks to Si Chen and David Jones for the help.
This will fix Jira issue OFBIZ-417.

Modified: trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java 2005-08-10 13:58:49 UTC (rev 5498)
+++ trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java 2005-08-10 16:21:02 UTC (rev 5499)
@@ -526,6 +526,8 @@
         session.removeAttribute("shoppingCart");
         session.removeAttribute("orderPartyId");
         session.removeAttribute("orderMode");
+        session.removeAttribute("productStoreId");
+        session.removeAttribute("CURRENT_CATALOG_ID");
         return "success";
     }
 
@@ -873,6 +875,11 @@
       String finalizeMode = (String)session.getAttribute("finalizeMode");
       Locale locale = UtilHttp.getLocale(request);
 
+      String productStoreId = request.getParameter("productStoreId");
+
+      if (UtilValidate.isNotEmpty(productStoreId)) {
+          session.setAttribute("productStoreId", productStoreId);
+      }
       ShoppingCart cart = getCartObject(request);
 
       String orderMode = request.getParameter("orderMode");
@@ -885,7 +892,6 @@
       }
 
       // check the selected product store
-      String productStoreId = request.getParameter("productStoreId");
       GenericValue productStore = null;
       if (UtilValidate.isNotEmpty(productStoreId)) {
           productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
@@ -917,7 +923,7 @@
               if (hasPermission) {
                   cart = ShoppingCartEvents.getCartObject(request, null, productStore.getString("defaultCurrencyUomId"));
               } else {
-               request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderYouDoNotHavePermissionToTakeOrdersForThisStore", locale));
+                  request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderYouDoNotHavePermissionToTakeOrdersForThisStore", locale));
                   cart.clear();
                   session.removeAttribute("orderMode");
                   return "error";
@@ -929,7 +935,7 @@
       }
 
       if ("SALES_ORDER".equals(cart.getOrderType()) && UtilValidate.isEmpty(cart.getProductStoreId())) {
-       request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderAProductStoreMustBeSelectedForASalesOrder", locale));
+          request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderAProductStoreMustBeSelectedForASalesOrder", locale));
           cart.clear();
           session.removeAttribute("orderMode");
           return "error";

Modified: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh 2005-08-10 13:58:49 UTC (rev 5498)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh 2005-08-10 16:21:02 UTC (rev 5499)
@@ -37,6 +37,10 @@
 
 context.put("dispatcher",dispatcher);
 
+// Just in case we are here from the choosecatalog form, the
+// following call will save in the session the new catalogId
+CatalogWorker.getCurrentCatalogId(request);
+
 // Get the Cart and Prepare Size
 shoppingCart = ShoppingCartEvents.getCartObject(request);
 context.put("shoppingCartSize", shoppingCart.size());

 
_______________________________________________
Svn mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/svn



 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users