Jump to content

martinlucas

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

martinlucas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for your continued help, but that didn't work. i amended the code as per your example; $rowtotal += number_format(($price * $qty),2); $output[] = '<td class="carttext" align="right">£'.$rowtotal.'</td>'; but it still shows up as £6.5 rather than £6.50.
  2. bumping this back to the top hoping for just a little more help with the exact formatting for the number_function() code. i've got a client with holding their invoice payment until this is fixed so it's really important.
  3. i need my hand held for just a little bit longer. (i think) because this is an include, the formatting of the php is a little different to your example. how do i wrap the number_format around the following; '.($price * $qty).' i've tried; 'number_format(.($price * £qty).,2)' but that didn't work - it screwed up the whole page - the cart no longer showed up!
  4. @milesp I know this is really bad, but the price field is actually text - i had some problems writing prices with .00 decimal points to the database using integers via dreamweaver and had to change it to text - which seems to work, as you can see, the line $output[] = '<td class="carttext">£'.$price.'</td>'; spits out a properly formatted price. @allworknoplay I did start to have a look at this, but I'm below a beginner at php and couldn't get my head around the exact formatting - nothing that i tried actually worked.
  5. i have built a website and a developer friend of mine built a very simple paypal shopping cart for me. http://www.fabricrehab.co.uk there is a problem with the shopping cart, if a product is £3.70 and the quantity is 1, the total for that will show as £3.7 - not £3.70, if the product price is multiplied by 10, for example if the price for a single unit is £2.99 the the total will display as £29.9 - not £29.90. here's the part of the include for the table row which displays the product that is in the cart, then takes the quantity in the text box multiplies this and displays it as the total. foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM products WHERE id = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td width="45px"><img src="images/fabric/thumb/'.$thumb.'" width="45px" height="45px"></td>'; $output[] = '<td class="carttext" align="center"><a href="cart.php?action=delete&id='.$id.'" class="r"><img src="images/deletecart.gif" border="0"></a></td>'; $output[] = '<td class="carttext">'.$name.'</td>'; $output[] = '<td class="carttext">£'.$price.'</td>'; $output[] = '<td class="carttext" align="center"><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td class="carttext" align="right">£'.($price * $qty).'</td>'; $total += $price * $qty; $output[] = '</tr>'; } i do hope all that makes sense. i guess i just need a way of formatting the part '.($price * $qty).' with 2 decimal places at all times. thanks in advance for your help and *fingers crossed* solutions.
×
×
  • 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.