Zen Cart Logo
Forums / Contribution-Writing Guidelines / Need cart total value only. No currency sign.

Need cart total value only. No currency sign.

Locked

Views: 4,214

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
1 Oct 2008, 10:08 AM
#1
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Need cart total value only. No currency sign.

I need to assign the value of the cart total to a variable, but when i pass the data using
$num_in_cart = $currencies->format($_SESSION['cart']->show_total());

$num_in_cart shows up as £52.99 for example.
I need to have the figure as 52.99 only.
How do i call the required data without the currency sign?

Thanks

Steve

1 Oct 2008, 10:26 AM
#2
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
1

Re: Need cart total value only. No currency sign.

You could just trim off the first character..

$num_in_cart = substr($num_in_cart, 1);
1 Oct 2008, 10:36 AM
#3
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: Need cart total value only. No currency sign.

That's what i thought, but if i try that i get a result such as pound;132.00
I'm now thinking that maybe i'm going to have to extract the prices from the array passed to the cart and add them together to get the figure as a pure integer.

Any other suggestions?

Thanks
Steve

1 Oct 2008, 11:37 AM
#4
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: Need cart total value only. No currency sign.

I found the solution to my problem. Just dropped the $currencies->format off and used $_SESSION['cart']->show_total();

Should have known it would be simple!

1 Oct 2008, 1:34 PM
#5
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Need cart total value only. No currency sign.

a simpler solution would have been to go into ZC ADMIN
go to localization -> curencies
highlihgt the default and set the descriptor to {blank}

no code mods needed

1 Oct 2008, 1:42 PM
#6
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
1

Re: Need cart total value only. No currency sign.

That would affect the front-end