Hi all,
I've found out that I can use only one currency per shop. But I prefer to let user change the currency, just like the language. Googling was of no help, so here's how I did it, might save someone some time. (I'm talking about ofbiz 12; newer didn't work for me) By analyzing eccommerce controller.xml and appropriate java code, I found out there is a way to set session currency, with a get request: ECOMMERCEURL/control/setSessionCurrencyUom?currencyUom=UOMID However, shopping cart igores session currency. That can be demonstrated by changing minicart.ftl, like this: <div id="minicart"> <h3>${uiLabelMap.OrderCartSummary} ${Request.currencyUomId} ${shoppingCart.getCurrency()} <@ofbizCurrency amount=shoppingCart.getDisplayGrandTotal() isoCode=shoppingCart.getCurrency()/></h3> I also found methods in place to set shopping cart currency. Just, they were not mapped to any requests in eccommerce controller.xml. So here's how I mapped it: <request-map uri="setCurrency"> <security https="false" auth="false"/> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="setCurrency"/> <response name="success" type="request-redirect" value="fromSetSessionLocale"/> <response name="error" type="view" value="main"/> </request-map> This allows changing shopping cart currency with a get request like: ECOMMERCEURL/control/seCurrency?currencyUomId=UOMID I'm not really sure about that fromSetSessionLocale redirect, but so far it seems to work. Regards... |
Hi Josip,
The missing request-map is certainly a missing aspect in current feature set of both the 12.x and other (incl. soon to be released) versions. Would you care to create a JIRA issue to have it resolved and incorporated in future releases? And attach your solution as a patch? Best regards, Pierre Smits *ORRTIZ.COM <http://www.orrtiz.com>* Services & Solutions for Cloud- Based Manufacturing, Professional Services and Retail & Trade http://www.orrtiz.com On Wed, Sep 10, 2014 at 10:56 AM, Josip Almasi <[hidden email]> wrote: > Hi all, > > I've found out that I can use only one currency per shop. > But I prefer to let user change the currency, just like the language. > Googling was of no help, so here's how I did it, might save someone some > time. > (I'm talking about ofbiz 12; newer didn't work for me) > > By analyzing eccommerce controller.xml and appropriate java code, I found > out there is a way to set session currency, with a get request: > ECOMMERCEURL/control/setSessionCurrencyUom?currencyUom=UOMID > > However, shopping cart igores session currency. That can be demonstrated > by changing minicart.ftl, like this: > > <div id="minicart"> > <h3>${uiLabelMap.OrderCartSummary} ${Request.currencyUomId} > ${shoppingCart.getCurrency()} <@ofbizCurrency amount=shoppingCart.getDisplayGrandTotal() > isoCode=shoppingCart.getCurrency()/></h3> > > I also found methods in place to set shopping cart currency. > Just, they were not mapped to any requests in eccommerce controller.xml. > So here's how I mapped it: > > <request-map uri="setCurrency"> > <security https="false" auth="false"/> > <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" > invoke="setCurrency"/> > <response name="success" type="request-redirect" > value="fromSetSessionLocale"/> > <response name="error" type="view" value="main"/> > </request-map> > > This allows changing shopping cart currency with a get request like: > ECOMMERCEURL/control/seCurrency?currencyUomId=UOMID > > I'm not really sure about that fromSetSessionLocale redirect, but so far > it seems to work. > > Regards... > |
Hi Pierre,
sure, glad to contribute. https://issues.apache.org/jira/browse/OFBIZ-5765 Regards... On 09/10/2014 01:59 PM, Pierre Smits wrote: > Hi Josip, > > The missing request-map is certainly a missing aspect in current feature > set of both the 12.x and other (incl. soon to be released) versions. > > Would you care to create a JIRA issue to have it resolved and incorporated > in future releases? And attach your solution as a patch? > > Best regards, > > Pierre Smits > > *ORRTIZ.COM <http://www.orrtiz.com>* > Services & Solutions for Cloud- > Based Manufacturing, Professional > Services and Retail & Trade > http://www.orrtiz.com > > On Wed, Sep 10, 2014 at 10:56 AM, Josip Almasi <[hidden email]> wrote: > >> Hi all, >> >> I've found out that I can use only one currency per shop. >> But I prefer to let user change the currency, just like the language. >> Googling was of no help, so here's how I did it, might save someone some >> time. >> (I'm talking about ofbiz 12; newer didn't work for me) >> >> By analyzing eccommerce controller.xml and appropriate java code, I found >> out there is a way to set session currency, with a get request: >> ECOMMERCEURL/control/setSessionCurrencyUom?currencyUom=UOMID >> >> However, shopping cart igores session currency. That can be demonstrated >> by changing minicart.ftl, like this: >> >> <div id="minicart"> >> <h3>${uiLabelMap.OrderCartSummary} ${Request.currencyUomId} >> ${shoppingCart.getCurrency()} <@ofbizCurrency amount=shoppingCart.getDisplayGrandTotal() >> isoCode=shoppingCart.getCurrency()/></h3> >> >> I also found methods in place to set shopping cart currency. >> Just, they were not mapped to any requests in eccommerce controller.xml. >> So here's how I mapped it: >> >> <request-map uri="setCurrency"> >> <security https="false" auth="false"/> >> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" >> invoke="setCurrency"/> >> <response name="success" type="request-redirect" >> value="fromSetSessionLocale"/> >> <response name="error" type="view" value="main"/> >> </request-map> >> >> This allows changing shopping cart currency with a get request like: >> ECOMMERCEURL/control/seCurrency?currencyUomId=UOMID >> >> I'm not really sure about that fromSetSessionLocale redirect, but so far >> it seems to work. >> >> Regards... >> > |
This may be related.
https://issues.apache.org/jira/browse/OFBIZ-4412 ------------------------------ *From:* "Josip Almasi" <[hidden email]> *To:* "[hidden email]" <[hidden email]> *Sent:* September 10, 2014 6:08 AM *Subject:* Re: ecommerce multicurrency Hi Pierre, sure, glad to contribute. https://issues.apache.org/jira/browse/OFBIZ-5765 Regards... On 09/10/2014 01:59 PM, Pierre Smits wrote: > Hi Josip, > > The missing request-map is certainly a missing aspect in current feature > set of both the 12.x and other (incl. soon to be released) versions. > > Would you care to create a JIRA issue to have it resolved and incorporated > in future releases? And attach your solution as a patch? > > Best regards, > > Pierre Smits > > *ORRTIZ.COM * > Services & Solutions for Cloud- > Based Manufacturing, Professional > Services and Retail & Trade > http://www.orrtiz.com > > On Wed, Sep 10, 2014 at 10:56 AM, Josip Almasi wrote: > >> Hi all, >> >> I've found out that I can use only one currency per shop. >> But I prefer to let user change the currency, just like the language. >> Googling was of no help, so here's how I did it, might save someone some >> time. >> (I'm talking about ofbiz 12; newer didn't work for me) >> >> By analyzing eccommerce controller.xml and appropriate java code, I found >> out there is a way to set session currency, with a get request: >> ECOMMERCEURL/control/setSessionCurrencyUom?currencyUom=UOMID >> >> However, shopping cart igores session currency. That can be demonstrated >> by changing minicart.ftl, like this: >> >> >> ${uiLabelMap.OrderCartSummary} ${Request.currencyUomId} >> ${shoppingCart.getCurrency()} <@ofbizCurrency amount=shoppingCart.getDisplayGrandTotal() >> isoCode=shoppingCart.getCurrency()/> >> >> I also found methods in place to set shopping cart currency. >> Just, they were not mapped to any requests in eccommerce controller.xml. >> So here's how I mapped it: >> >> >> >> > invoke="setCurrency"/> >> > value="fromSetSessionLocale"/> >> >> >> >> This allows changing shopping cart currency with a get request like: >> ECOMMERCEURL/control/seCurrency?currencyUomId=UOMID >> >> I'm not really sure about that fromSetSessionLocale redirect, but so far >> it seems to work. >> >> Regards... >> > |
Yep, 4412 can't work unless web shopping cart accepts session currency.
I think I've identified the problem and fixed WebShoppingCart: https://issues.apache.org/jira/browse/OFBIZ-5767 Regards... On 09/10/2014 06:41 PM, Mike Z wrote: > This may be related. > > https://issues.apache.org/jira/browse/OFBIZ-4412 > > ------------------------------ > *From:* "Josip Almasi" <[hidden email]> > *To:* "[hidden email]" <[hidden email]> > *Sent:* September 10, 2014 6:08 AM > *Subject:* Re: ecommerce multicurrency > > Hi Pierre, > > sure, glad to contribute. > https://issues.apache.org/jira/browse/OFBIZ-5765 > > Regards... > > On 09/10/2014 01:59 PM, Pierre Smits wrote: >> Hi Josip, >> >> The missing request-map is certainly a missing aspect in current feature >> set of both the 12.x and other (incl. soon to be released) versions. >> >> Would you care to create a JIRA issue to have it resolved and incorporated >> in future releases? And attach your solution as a patch? >> >> Best regards, >> >> Pierre Smits >> >> *ORRTIZ.COM * >> Services & Solutions for Cloud- >> Based Manufacturing, Professional >> Services and Retail & Trade >> http://www.orrtiz.com >> >> On Wed, Sep 10, 2014 at 10:56 AM, Josip Almasi wrote: >> >>> Hi all, >>> >>> I've found out that I can use only one currency per shop. >>> But I prefer to let user change the currency, just like the language. >>> Googling was of no help, so here's how I did it, might save someone some >>> time. >>> (I'm talking about ofbiz 12; newer didn't work for me) >>> >>> By analyzing eccommerce controller.xml and appropriate java code, I found >>> out there is a way to set session currency, with a get request: >>> ECOMMERCEURL/control/setSessionCurrencyUom?currencyUom=UOMID >>> >>> However, shopping cart igores session currency. That can be demonstrated >>> by changing minicart.ftl, like this: >>> >>> > >>> ${uiLabelMap.OrderCartSummary} ${Request.currencyUomId} >>> ${shoppingCart.getCurrency()} <@ofbizCurrency amount=shoppingCart.getDisplayGrandTotal() >>> isoCode=shoppingCart.getCurrency()/> >>> >>> I also found methods in place to set shopping cart currency. >>> Just, they were not mapped to any requests in eccommerce controller.xml. >>> So here's how I mapped it: >>> >>> >>> >>> > invoke="setCurrency"/> >>> > value="fromSetSessionLocale"/> >>> >>> >>> >>> This allows changing shopping cart currency with a get request like: >>> ECOMMERCEURL/control/seCurrency?currencyUomId=UOMID >>> >>> I'm not really sure about that fromSetSessionLocale redirect, but so far >>> it seems to work. >>> >>> Regards... >>> >> > |
Free forum by Nabble | Edit this page |