News:

Support the VirtueMart project and become a member

Main Menu

Total Cart Amount decimal point issue

Started by lobebe, August 28, 2015, 10:09:26 AM

Previous topic - Next topic

lobebe

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

Studio 42

Hi,
change
echo $fsbs.',0 &euro;';?>
to
echo $fsbs.'0 &euro;';?>
you have a comma for nothing

lobebe

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

GJC Web Design

echo number_format($fsbs,2,',','').'&euro;';
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lobebe

It works like magic. Thank you very much

Studio 42

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 ;)