Jump to content

hveing problems with costs adding up


fazz

Recommended Posts

I have a shopping cart, and each client that logs on has a budget spend -  am testing it with a budget of 5000.

 

So I have created this that works until the toal goes past 999

 

 

<?php
		  $Budget = $HTTP_GET_VARS['Budget'];
		  $TotalCart = $HTTP_SESSION_VARS["icNamco"]->col("Total");
		  echo number_format ($Budget - $TotalCart);
		  ?>

 

It deducts and gives me the correct total until it goes over 999 and the reverts to displaying 4,999

 

 

Can any one shine any light on this!

 

Merry christmas to everyone!

Link to comment
Share on other sites

I have now found this and changed my code

<?php
				//Add up toal items and - from Budget cost: does not work correctley over 999.00
              $Budget = $HTTP_GET_VARS['Budget'];
		  $TotalCart = $HTTP_SESSION_VARS["icNamco"]->col("Total");
              $BudgetRemain = $Budget - $TotalCart;
		  echo number_format ($BudgetRemain, 0, "", ",");
		  ?>

 

I now have a budget of 485 when I add a total of 595 into my cart it says the remaining budet is '-110'

 

I add a second item of 415 and then the toal says £484 instead of - 594 I just can't seem to work it out?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.