Fwd: svn commit: r450107 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: svn commit: r450107 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Si Chen-2
Hi David,

Just curious, what kind of products are exploded this way, and how  
are they configured in catalog manager?  Or is this for some other  
kind of use case?

Si


Begin forwarded message:

> From: [hidden email]
> Date: September 26, 2006 9:28:23 AM PDT
> To: [hidden email]
> Subject: svn commit: r450107 - /incubator/ofbiz/trunk/applications/
> order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> Reply-To: [hidden email]
>
> Author: jonesde
> Date: Tue Sep 26 09:28:22 2006
> New Revision: 450107
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=450107
> Log:
> Added a method to explode a list of cart items, or in other words  
> unitize them, or in other words for each item of X quantity, create  
> X items of 1 quantity
>
> Modified:
>     incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/
> shoppingcart/ShoppingCart.java
>
> Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/
> order/shoppingcart/ShoppingCart.java
> URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/ 
> applications/order/src/org/ofbiz/order/shoppingcart/
> ShoppingCart.java?view=diff&rev=450107&r1=450106&r2=450107
> ======================================================================
> ========
> --- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/
> shoppingcart/ShoppingCart.java (original)
> +++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/
> shoppingcart/ShoppingCart.java Tue Sep 26 09:28:22 2006
> @@ -2984,20 +2984,43 @@
>      }
>
>      private void explodeItems(LocalDispatcher dispatcher) {
> +        if (dispatcher == null) return;
>          synchronized (cartLines) {
> -            if (dispatcher != null) {
> -                List cartLineItems = new LinkedList(cartLines);
> -                Iterator itemIter = cartLineItems.iterator();
> +            List cartLineItems = new LinkedList(cartLines);
> +            Iterator itemIter = cartLineItems.iterator();
>
> -                while (itemIter.hasNext()) {
> -                    ShoppingCartItem item = (ShoppingCartItem)  
> itemIter.next();
> +            while (itemIter.hasNext()) {
> +                ShoppingCartItem item = (ShoppingCartItem)  
> itemIter.next();
>
> -                    Debug.logInfo("Item qty: " + item.getQuantity
> (), module);
> -                    try {
> -                        item.explodeItem(this, dispatcher);
> -                    } catch (CartItemModifyException e) {
> -                        Debug.logError(e, "Problem exploding item!  
> Item not exploded.", module);
> -                    }
> +                //Debug.logInfo("Item qty: " + item.getQuantity(),  
> module);
> +                try {
> +                    item.explodeItem(this, dispatcher);
> +                } catch (CartItemModifyException e) {
> +                    Debug.logError(e, "Problem exploding item!  
> Item not exploded.", module);
> +                }
> +            }
> +        }
> +    }
> +
> +    /**
> +     * Does an "explode", or "unitize" operation on a list of cart  
> items.
> +     * Resulting state for each item with quantity X is X items of  
> quantity 1.
> +     *
> +     * @param shoppingCartItems
> +     * @param dispatcher
> +     */
> +    public void explodeItems(List shoppingCartItems,  
> LocalDispatcher dispatcher) {
> +        if (dispatcher == null) return;
> +        synchronized (cartLines) {
> +            Iterator itemIter = shoppingCartItems.iterator();
> +            while (itemIter.hasNext()) {
> +                ShoppingCartItem item = (ShoppingCartItem)  
> itemIter.next();
> +
> +                //Debug.logInfo("Item qty: " + item.getQuantity(),  
> module);
> +                try {
> +                    item.explodeItem(this, dispatcher);
> +                } catch (CartItemModifyException e) {
> +                    Debug.logError(e, "Problem exploding  
> (unitizing) item! Item not exploded.", module);
>                  }
>              }
>          }
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r450107 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

David E Jones-2

This is just a routine that custom code can use if it needs to split  
stuff up, it doesn't do anything automatic but is pretty much the  
same thing as the order explosion option on the ProductStore, though  
that happens on order creation and not in the cart before checkout  
where this can also be used.

-David


On Sep 29, 2006, at 10:38 PM, Si Chen wrote:

> Hi David,
>
> Just curious, what kind of products are exploded this way, and how  
> are they configured in catalog manager?  Or is this for some other  
> kind of use case?
>
> Si
>
>
> Begin forwarded message:
>
>> From: [hidden email]
>> Date: September 26, 2006 9:28:23 AM PDT
>> To: [hidden email]
>> Subject: svn commit: r450107 - /incubator/ofbiz/trunk/applications/
>> order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
>> Reply-To: [hidden email]
>>
>> Author: jonesde
>> Date: Tue Sep 26 09:28:22 2006
>> New Revision: 450107
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=450107
>> Log:
>> Added a method to explode a list of cart items, or in other words  
>> unitize them, or in other words for each item of X quantity,  
>> create X items of 1 quantity
>>
>> Modified:
>>     incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/
>> shoppingcart/ShoppingCart.java
>>
>> Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/
>> order/shoppingcart/ShoppingCart.java
>> URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/ 
>> applications/order/src/org/ofbiz/order/shoppingcart/
>> ShoppingCart.java?view=diff&rev=450107&r1=450106&r2=450107
>> =====================================================================
>> =========
>> --- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/
>> shoppingcart/ShoppingCart.java (original)
>> +++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/
>> shoppingcart/ShoppingCart.java Tue Sep 26 09:28:22 2006
>> @@ -2984,20 +2984,43 @@
>>      }
>>
>>      private void explodeItems(LocalDispatcher dispatcher) {
>> +        if (dispatcher == null) return;
>>          synchronized (cartLines) {
>> -            if (dispatcher != null) {
>> -                List cartLineItems = new LinkedList(cartLines);
>> -                Iterator itemIter = cartLineItems.iterator();
>> +            List cartLineItems = new LinkedList(cartLines);
>> +            Iterator itemIter = cartLineItems.iterator();
>>
>> -                while (itemIter.hasNext()) {
>> -                    ShoppingCartItem item = (ShoppingCartItem)  
>> itemIter.next();
>> +            while (itemIter.hasNext()) {
>> +                ShoppingCartItem item = (ShoppingCartItem)  
>> itemIter.next();
>>
>> -                    Debug.logInfo("Item qty: " + item.getQuantity
>> (), module);
>> -                    try {
>> -                        item.explodeItem(this, dispatcher);
>> -                    } catch (CartItemModifyException e) {
>> -                        Debug.logError(e, "Problem exploding  
>> item! Item not exploded.", module);
>> -                    }
>> +                //Debug.logInfo("Item qty: " + item.getQuantity
>> (), module);
>> +                try {
>> +                    item.explodeItem(this, dispatcher);
>> +                } catch (CartItemModifyException e) {
>> +                    Debug.logError(e, "Problem exploding item!  
>> Item not exploded.", module);
>> +                }
>> +            }
>> +        }
>> +    }
>> +
>> +    /**
>> +     * Does an "explode", or "unitize" operation on a list of  
>> cart items.
>> +     * Resulting state for each item with quantity X is X items  
>> of quantity 1.
>> +     *
>> +     * @param shoppingCartItems
>> +     * @param dispatcher
>> +     */
>> +    public void explodeItems(List shoppingCartItems,  
>> LocalDispatcher dispatcher) {
>> +        if (dispatcher == null) return;
>> +        synchronized (cartLines) {
>> +            Iterator itemIter = shoppingCartItems.iterator();
>> +            while (itemIter.hasNext()) {
>> +                ShoppingCartItem item = (ShoppingCartItem)  
>> itemIter.next();
>> +
>> +                //Debug.logInfo("Item qty: " + item.getQuantity
>> (), module);
>> +                try {
>> +                    item.explodeItem(this, dispatcher);
>> +                } catch (CartItemModifyException e) {
>> +                    Debug.logError(e, "Problem exploding  
>> (unitizing) item! Item not exploded.", module);
>>                  }
>>              }
>>          }
>>
>