VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: lobebe on August 28, 2015, 10:09:26 AM

Title: Total Cart Amount decimal point issue
Post by: lobebe on August 28, 2015, 10:09:26 AM
Hello everyone,

I have a heavily customised virtuemart and I have issue with the total price in cart, here is the code I am using:

<td class="col-total" align="right"><?php $bse = $this->cart->pricesUnformatted['salesPrice'] ;
                     $sps = $this->cart->pricesUnformatted['salesPriceShipment'];
                     $spp = $this->cart->pricesUnformatted['salesPricePayment'];
                     $fsbs = ($bse + $sps + $spp);
                     echo $fsbs.',0 &euro;';?>
               </td>   

and assume the total is 54,90 and the result shows 54.9,0

How can I make it look like 54,90

I look forward to your response.

Thank you
Adeola
Title: Re: Total Cart Amount decimal point issue
Post by: Studio 42 on August 28, 2015, 10:40:06 AM
Hi,
change
echo $fsbs.',0 &euro;';?>
to
echo $fsbs.'0 &euro;';?>
you have a comma for nothing
Title: Re: Total Cart Amount decimal point issue
Post by: lobebe on August 28, 2015, 11:21:31 AM
The thing is the site uses , as the decimal point and that is what I am trying to achieve. With the above the decimal point is . which I want to change to ,

Thank you for your help
Title: Re: Total Cart Amount decimal point issue
Post by: GJC Web Design on August 28, 2015, 12:06:12 PM
echo number_format($fsbs,2,',','').'&euro;';
Title: Re: Total Cart Amount decimal point issue
Post by: lobebe on August 28, 2015, 12:36:51 PM
It works like magic. Thank you very much
Title: Re: Total Cart Amount decimal point issue
Post by: Studio 42 on August 30, 2015, 00:29:58 AM
Quote from: GJC Web Design on August 28, 2015, 12:06:12 PM
echo number_format($fsbs,2,',','').'&euro;';

Next time i read a little more the code ;)