Virtuemart - decimal quantity

Before you ask about IDnR Addon see the VirtueMart - Invoice, Delivery Note and Receipt Addon
sender
Phoca Member
Phoca Member
Posts: 12
Joined: 26 Jun 2010, 22:58

Virtuemart - decimal quantity

Post by sender »

I use this hack for selling decimal quantity in Virtuemart - and I have little problem

http://forum.virtuemart.net/index.php?t ... t=prev#new

this solution is working fine but I have a problem:
My customers still have to type 0.5 instead of 0,5 (my shop is located in Czech republic aswell)?

So you are a master in PHP and Virtuemart too. Can you provide the solution for Europe for it? I think that this is problem for many e-shops who want to sell goods in meters and kg, l.

If you can not interesting in it, never mine.

Thanks anyway.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Virtuemart - decimal quantity

Post by Jan »

Just make some str_replace function:

$value = str_replace(',', '.', $value);

So if user add 5,50 this will be translated to 5.50

The same you can make for outputs:

if somewhere will be loaded 5.50 ... this will be changed to 5,50 (for formfields)

$value = str_replace('.', ',', $value);

Jan
If you find Phoca extensions useful, please support the project
sender
Phoca Member
Phoca Member
Posts: 12
Joined: 26 Jun 2010, 22:58

Re: Virtuemart - decimal quantity

Post by sender »

Sorry for my stupidity.

Im not PHP expert? Have somebody complex solution for this?

Thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Virtuemart - decimal quantity

Post by Jan »

Hi, which addon do you use, the old one or new version?

https://www.phoca.cz/documents/18-virtue ... eipt-addon

Jan
If you find Phoca extensions useful, please support the project
Post Reply