Hi,
As we discussed separately in the email, the behavior is a consequence of the current design of CMSDesk order generation, which may not suit some scenarios, including the multilingual store and the need to regenerate the invoice in original language of the order.
However, it should work for the invoice sent via email when the Order is complete, if you enable following setting:
Use customer's culture for e-mails in
E-Commerce / Configuration / Store settings / E-mails.
or do you see the behavior for both emailed and manually regenerated Invoice?
Your observation in code is anyway correct. Just before the Invoice template macro resolver is obtained, the Culture of the shopping cart created from the Order is set to the default site culture. I have already solved this issue with some other customers and forwarded their feedback to our development team. Currently, it's not considered as a bug, but we will look into it for the new version.
The explanation for current behavior is that the emails to the customer should be send in his culture, where the Invoice generated by the E-commerce administrator should be in default culture.
I know this is a limitation for certain scenarios. Our developers know about this and they will consider some improvements into next versions.
As I cannot confirm any out-of-the-box solution in near time, I offer a workaround here. Among current workaround options (with respect to the upcoming hotfixes and updates), the best way seems to be to write
CustomShoppingCartInfoProvider.
The only important thing to decide is where to get the correct Culture from - the best is of course to use the original
OrderCulture stored within the Order.
In short, the override of
GetShoppingCartResolverInternal method will allow to specify the desired culture of the resolver.
In custom
ShoppingCartInfoProvider it can look like this:
protected override MacroResolver GetShoppingCartResolverInternal(ShoppingCartInfo cart, bool specialMacros)
{
MacroResolver result = base.GetShoppingCartResolverInternal(cart, specialMacros);
if (cart.Order != null)
{
OrderInfo origOrder = OrderInfoProvider.GetOrderInfo(cart.Order.OrderID);
if (origOrder != null)
{
result.Culture = origOrder.OrderCulture;
}
}
return result;
}
Hope this helps.
If you have any feedback to this suggestion, please feel free to share it here or via email.
Regards,
Zdenek