ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohit2006 <rohitksur...@yahoo.com>
Subject Re: How to set-up Multicurrency in ofbiz
Date Wed, 03 Jun 2009 05:06:12 GMT

Hi Abhishake,

Did you check the code for setSessionLocale. I guess, that the information
for language and currency is stored in the locale session. If you also check
the code for create a new webshopping cart, pasted below, it gets the
currency from the locale. So i think the code should work as it is, but it
does not.

On the demo server too, when the locale is change to say, English (Great
Britain), the configurable products shows the prices in GBP and not any
other products. Also when a configurable product, quoted in GBP, is added to
the shopping card, the currency is change to USD.

I thus think multi-currency feature is already build in, but the code for
shoppingcart and product prices have some error.

I did not try your code, but will soon try and let you know if it works for
me.

Rohit

    /** Gets or creates the shopping cart object */
    public static ShoppingCart getCartObject(HttpServletRequest request,
Locale locale, String currencyUom) {
        LocalDispatcher dispatcher = (LocalDispatcher)
request.getAttribute("dispatcher");
        ShoppingCart cart = (ShoppingCart)
request.getAttribute("shoppingCart");
        HttpSession session = request.getSession(true);
        if (cart == null) {
            cart = (ShoppingCart) session.getAttribute("shoppingCart");
        } else {
            session.setAttribute("shoppingCart", cart);
        }

        if (cart == null) {
            cart = new WebShoppingCart(request, locale, currencyUom);
            session.setAttribute("shoppingCart", cart);
        } else {
            if (locale != null && !locale.equals(cart.getLocale())) {
                cart.setLocale(locale);
            }
            if (currencyUom != null &&
!currencyUom.equals(cart.getCurrency())) {
                try {
                    cart.setCurrency(dispatcher, currencyUom);
                } catch (CartItemModifyException e) {
                    Debug.logError(e, "Unable to modify currency in cart",
module);
                }
            }
        }
        return cart;
    }



Abhishake Agarwal wrote:
> 
> Hi,
> 
> please look at the link below
> 
> http://mail-archives.apache.org/mod_mbox/ofbiz-dev/200810.mbox/%3Ccaaebcd20810122206n2c0261d0t2dbb46ced85c61b5@mail.gmail.com%3E
> 
> Regards,
> Abhishake
> 
> On Mon, Jun 1, 2009 at 11:38 AM, rohit2006 <rohitksureka@yahoo.com> wrote:
> 
>>
>> Hi,
>>
>> I have a requirement to show product prices in difference currency. From
>> what i understand, ofbiz supports multicurrency, but i have been unable
>> to
>> set it up.
>>
>> I tried the following actions on the demo ofbiz server. I added the price
>> in
>> GBP for the product ID WG-5569. I did not set the default currency for
>> the
>> store to GBP, but instead tried to set default currency for the session
>> using the the URI
>>
>> http://demo.ofbiz.org/ecommerce/products/PROMOTIONS/p_WG-5569?setSessionCurrencyUom?currencyUom=GBP
>>
>> Still the prices are shown in USD, i will appreciate if someone can help
>> me
>> with this.
>>
>> What i am trying to achieve is, that the default currency should be USD,
>> however when user from UK access the products, with URL's amended with
>> currency information, the product page should show the prices in GBP
>> instead
>> of USD.
>>
>> Thanks for the help.
>>
>> Rohit
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-set-up-Multicurrency-in-ofbiz-tp23810343p23810343.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-up-Multicurrency-in-ofbiz-tp23810343p23845433.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Mime
View raw message