Jump to content


Photo

Adding a number to a set value


  • Please log in to reply
3 replies to this topic

#1 ImJustBrndn

ImJustBrndn
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 03 September 2006 - 10:29 PM

I have a shopping cart system set up and I want to have a button that adds $4.00 to the total if the shipment is going international. I would like to know if there is a "add" command or something like that, that I can have this button point to, to add $4.00 to the total value of the shipment. This is the cart code as far as the money values go.

                        $totalvalue = $totalvalue + ($item["price"]*$ses_quan);
$subtotal = ($item["price"]*$ses_quan);
$shipping = 3.50 + ($totalvalue / 18.00 * 1.00);
$finalvalue = $totalvalue + $shipping

I would like to add $4.00 only on international shipments. Can someone tell me how to go about it and if there is a way to add that as a variable like..  $finalvalue = $totalvalue + $shipping + $international .... But how would I get it to figure the variable international bc I only want it to be $4.00 on certain shipments. Thanks in advance.

Brandon

#2 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 03 September 2006 - 11:08 PM

The way I would do it -- depending on the cart system -- is look where it defines the tax rate..  then after the tax rate is figured out throw something like this..

if ($location == "international") {
$shipping = ($shipping) + ('4.00');
}

Something similar should work...

#3 ImJustBrndn

ImJustBrndn
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 04 September 2006 - 01:35 AM

Ok thanks alot man.

#4 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 04 September 2006 - 01:39 AM

can also do
<?php

$var += 4;

?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users