Developer forum

Forum » Ecommerce - Standard features » Price pattern not being honored

Price pattern not being honored

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

We noticed that the currency pattern is not being honored in some prices. This is true for both Cart tags and OrderViewModel PriceViewModel properties

 

Cart

In this example, you can notice the missing space compared to the other prices

 

Order

In this example I changed the pattern on purpose so the symbol is after the amount, and we can clearly see it not being honored

 

I confirmed it in both 9.13.11 and 9.14.2

 

As a workaround for the customer, I forced the pattern to match the hardcoded one used for discounts.

 

Best Regards,

Nuno Aguiar


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

And btw, this also happens with the Price Matrix prices - they come with a hardcoded pattern as well

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Nuno

I just think you cannot figure out how to use currency formatting :-).

The discount is a negative number and hence uses the negative pattern - so I think this is the setting you need to fiddle with:

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Lol... you are absolutely... note to self: Rest some more :P

 

Sorry about that

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Lol. Just happy I can still get you :-)

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Well done ;)

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

I was still having the issue and figured it out. Not sure if it's something you should fix in Dynamicweb though.

 

There was a customization and we were using Dynamicweb.Ecommerce.Services.Currencies.FormatCurrency(). Apparently this method does not honor the proper pattern when we want to render the currency symbol. I changed it to Dynamicweb.Ecommerce.Services.Currencies.Format() and it started working as expected.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

FormatCurrency is the "old" way where it uses a format string.

Format is the "New" way where it uses the cultureinfo specified on the currency. Format calls formatCurrency if no culture is specified so calling that is the safe bet.

BR Nicolai

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Perfect then.

 

I looked at DW's source code because I was thinking it should have been marked as "Obsolete", but I realize it's not but it's still being used.

 

Maybe to avoid confusions we could:

  • Mark "FormatCurrency" as obsolete
  • Refactor Dynamicweb's usage of FormatCurrency to another internal method (copy of FormatCurrency) 

 

That would ensure any future usage of FormatCurrency() is properly interpreted by developers.

 

Best Regards,

Nuno Aguiar

 

You must be logged in to post in the forum