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...