atom feed8 messages in org.apache.ofbiz.devRe: Set currency dynamically on ecomm...
FromSent OnAttachments
Abhishake AgarwalOct 5, 2008 10:05 am 
Abhishake AgarwalOct 5, 2008 10:27 am 
Jacques Le RouxOct 12, 2008 1:46 pm 
Abhishake AgarwalOct 12, 2008 10:06 pm 
Abhishake AgarwalOct 12, 2008 10:38 pm 
Jacques Le RouxOct 13, 2008 6:43 am 
Abhishake AgarwalOct 13, 2008 11:10 am 
Jacques Le RouxOct 13, 2008 12:31 pm 
Subject:Re: Set currency dynamically on ecommerce
From:Abhishake Agarwal (abhi@gmail.com)
Date:Oct 12, 2008 10:38:51 pm
List:org.apache.ofbiz.dev

Hi,

I have one more query related to this,

Suppose I changed currency from $ to £ now all products prices, whose currencies has been configured in £ will be displayed.

Problem come when we are on checkout screen as for shipping method cost is configured with single currency.

example: if shipping method cost is 20 $ then it will display 20 £ which is incorrect (its just change the sign not the value).

Please let me know is there a fix to it.

Regards, Abhishake

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 < jacq@les7arts.com> 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:de@ofbiz.apache.org

Thanks

Jacques

From: "Abhishake Agarwal" <abhi@gmail.com>

Hi,

I tried following URL to set currency but it is not working

http://demo.hotwaxmedia.com/ecommerce/control/setSessionCurrencyUom?currencyUom=INR

Regards, Abhishake

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