Hi,

I have resolved the issue actually currency should be set to shopping cart
object also.

I have modified the setSessionCurrencyUom method as below and it was working
fine

public static String setSessionCurrencyUom(HttpServletRequest request,
HttpServletResponse response) {
        String currencyUom = request.getParameter("currencyUom");
        LocalDispatcher dispatcher = (LocalDispatcher)
request.getAttribute("dispatcher");
        if (UtilValidate.isNotEmpty(currencyUom)) {
            // update the session
            UtilHttp.setCurrencyUom(request.getSession(), currencyUom);

            // update the UserLogin object
            GenericValue userLogin = (GenericValue)
request.getSession().getAttribute("userLogin");
            if (userLogin == null) {
                userLogin = (GenericValue)
request.getSession().getAttribute("autoUserLogin");
            }

            if (userLogin != null) {
                GenericValue ulUpdate = GenericValue.create(userLogin);
                ulUpdate.set("lastCurrencyUom", currencyUom);
                try {
                    ulUpdate.store();
                    userLogin.refreshFromCache();

                } catch (GenericEntityException e) {
                    Debug.logWarning(e, module);
                }
                ShoppingCart cart =
ShoppingCartEvents.getCartObject(request);
                try {
                    cart.setCurrency(dispatcher,currencyUom);
                } catch (CartItemModifyException e) {
                    Debug.logWarning(e, module);
                }
            }
        }
        return "success";
    }

Regards,
Abhishake

On Mon, Oct 13, 2008 at 2:16 AM, Jacques Le Roux <
[EMAIL PROTECTED]> wrote:

> I also tried in UI (nothing happens as far as I can tell), and looked after
> at the code. I ran out of time but it seems that OOTB only the Product Store
> Currency is taken into account (through
> ProductStoreWorker.getStoreCurrencyUomId when the
> WebShoppingCart is created). So you would have to re-create your
> WebShoppingCart passing your currency from the Session
>
> Please use rather user ML for such questions :
>
> http://docs.ofbiz.org/display/OFBADMIN/Mailing+Lists#MailingLists-DeveloperList:dev@ofbiz.apache.org
>
> Thanks
>
> Jacques
>
> From: "Abhishake Agarwal" <[EMAIL PROTECTED]>
>
>  Hi,
>>
>> I tried following URL to set currency but it is not working
>>
>>
>> http://demo.hotwaxmedia.com/ecommerce/control/setSessionCurrencyUom?currencyUom=INR
>>
>> Regards,
>> Abhishake
>>
>> On Sun, Oct 5, 2008 at 10:36 PM, Abhishake Agarwal <
>> [EMAIL PROTECTED]> wrote:
>>
>>  Hi,
>>>
>>> I want to know whether it is possible to set currency dynamically.
>>>
>>> Suppose on ecommerce application, I have a currency options and if user
>>> select any of the type of currency, application should set that currency
>>> for
>>> that user.
>>>
>>> Regards,
>>> Abhishake
>>>
>>>
>>
>

Reply via email to