[OFBiz] Dev - Calling a java event many times (suchas theservice-multi events)

Si Chen schen at graciousstyle.com
Tue Jan 18 13:45:00 EST 2005


Hi Jacopo,

It is possible that the changes are not being triggered automatically.  
The changes I made were:

in ShoppingCartHelper.addToCart - there is some code to see if we are 
working on a PURCHASE_ORDER.  If so, it calls a method in 
ShoppingCartHelper called getProductSupplier to find the right 
SupplierProduct entity for the given supplier and quantity.  It will 
then pass this on to ShoppingCart.addOrIncreaseItem
in ShoppingCart.addOrIncreaseItem - there is a new method which has a 
parameter at the end, GenericValue supplierProduct.  If there is a 
supplierProduct, it will call the ShoppingCart.makePurchaseOrderItem 
method to create the shopping cart item based on the supplier 
description, etc. etc.

I think you might be able to get the logic in 
ShoppingCartHelper.addToCart to find the supplier information and then 
pass it to ShoppingCart.addOrIncreaseItem? 

The changes are in SVN revision #4291, look for ShoppingCartHelper, 
ShoppingCart, and ShoppingCartItem changes, and let me know if you have 
any questions.

Si

Jacopo Cappellato wrote:

> Thanks Si,
>
> I've found that and I'm using it to do what I need (i.e. adding cart 
> items from requirements... as you probably know ;-)). About this 
> subject... is it possible that some of the new logics for po 
> (supplier's name and price retrieval etc...) that you have implemented 
> are not triggered when you add multiple item at once instead of using 
> the single form?
>
> Again thanks,
>
> Jacopo
>
>
> ----- Original Message ----- From: "Si Chen" <schen at graciousstyle.com>
> To: "OFBiz Project Development Discussion (High Traffic)" 
> <dev at lists.ofbiz.org>
> Sent: Tuesday, January 18, 2005 6:39 PM
> Subject: Re: [OFBiz] Dev - Calling a java event many times (suchas 
> theservice-multi events)
>
>
>> Hi Jacopo,
>>
>> David showed a "Quick Add" category at the users' conference last 
>> year where you can add multiple items to the cart at once.  Maybe you 
>> can take a look at that and see if it satisfies your requirement?
>>
>> If not, I have some code for adding multiple items to the cart from a 
>> form that I can send to you.  Let me know if you want to see it.
>>
>> Si
>>
>>
>> Jacopo Cappellato wrote:
>>
>>> David, BJ,
>>>
>>> thanks for your help.
>>> David, the only reason for not implementing this as a service is 
>>> that the additem event is actually implemented as a 'java' event 
>>> (ShoppingCartEvents.addToCart) and I was trying to re-use it. 
>>> However it was not probably a good idea, so I'm writing a new 'java' 
>>> event in ShoppingCartEvents that can process rows from a multi form 
>>> (actually adding requirements to the shopping cart).
>>>
>>> Jacopo
>>>
>>>
>>> ----- Original Message ----- From: "David E. Jones" <jonesde at ofbiz.org>
>>> To: "OFBiz Project Development Discussion (High Traffic)"
>>> <dev at lists.ofbiz.org>
>>> Sent: Tuesday, January 18, 2005 1:09 PM
>>> Subject: Re: [OFBiz] Dev - Calling a java event many times (such as
>>> theservice-multi events)
>>>
>>>
>>> Jacopo,
>>>
>>> I'm not sure what a multi-event type handler would look like, though I
>>> suppose it could work.
>>>
>>> Wrapping an even with a service is in general a pretty bad idea since
>>> it requires moving in the wrong direction through the architectural
>>> tiers, and therefore will most likely cause "real world" problems as
>>> well.
>>>
>>> The approach taken to date for this sort of thing is to have a wrapping
>>> event, which requires more work per-event, but usually if it is not
>>> possible to put the logic in a service (why isn't that possible by the
>>> way?), then other generic tools also don't do so well.
>>>
>>> -David
>>>
>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev at lists.ofbiz.org
>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at lists.ofbiz.org
>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev at lists.ofbiz.org
>> http://lists.ofbiz.org/mailman/listinfo/dev 
>
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.ofbiz.org
> http://lists.ofbiz.org/mailman/listinfo/dev
>


More information about the Dev mailing list