
June 5th, 2002, 12:58 PM
|
|
Contributing User
|
|
Join Date: May 2002
Location: Southern California, USA
Posts: 48
Time spent in forums: < 1 sec
Reputation Power: 8
|
|
Hi Frank,
According to email message you sent me: Quote: The thing I want to do about the script is that when the user press check-out, the check-out page will display the products from the cart.php, shipping-cost and the total cost. Under that I would have a form, so the user fill out his information. No credit-cart or something like that. Just a simple form that send me an email
with the products that the user will buy.
Very simple! 
|
In other pages, you create a checkout button link to, say checkout.php. Then,
To display all products in a cart, their shipping costs and totals and grand total cost
PHP Code:
$totalcost = 0;
$grandtotal = 0;
$totalshipcost = 0;
echo "Here's is the order info...";
$result = mysql_query("select * from cart inner join items on cart.itemId = items.itemId where cart.cookieId = '" . GetCartId() . "' order by items.itemName asc");
if (db_num_rows($result) == 0)
{
//echo "Your cart is currently empty. Click here to....
}
else
{
while($row = mysql_fetch_array($result))
{
//display item name here
//display total qty of each item
//display each item sub total cost
$subtotal = $row["qty"] * $row["itemPrice"];
//display total shipping cost for this particular line of product. It depends on your business on how to come up with shipping cost formula
$shippingcost = ....???
$totalcost += $subtotal;
$totalshipcost += $shippingcost;
}
}
// display $totalcost and $totalshipcost
// display $grandtotal = display $totalcost + $totalshipcost;
and then you can display a form for customers to enter their info.
|