smallc28 Posted November 18, 2012 Share Posted November 18, 2012 Sorry not that pro at phpcart.php Quote Link to comment Share on other sites More sharing options...
Zane Posted November 19, 2012 Share Posted November 19, 2012 Do not expect to get very much help from this community by attaching the PHP file. Our community is full of people who are weary to download a file from a complete stranger mainly for security breech reasons. That could easily be an executable whose extension is changed. Especially since you are absolutely new here. Post the code (within code tags please), and rephrase your question to be more clear Quote Link to comment Share on other sites More sharing options...
smallc28 Posted November 19, 2012 Author Share Posted November 19, 2012 (edited) Sorry about my last post a bit new to this site What I'm trying to figure out is how can I add Total Tax.Total Including Tax: to my shopping cart. <?php $cartOutput = ""; $cartTotal = ""; $pp_checkout_btn = ''; $product_id_array = ''; if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) { $cartOutput = "<h2 align='center'>Your shopping cart is empty</h2>"; } else { // Start PayPal Checkout Button $pp_checkout_btn .= '<form action="[url="https://www.paypal.com/cgi-bin/webscr"]https://www.paypal.c...cgi-bin/webscr"[/url] method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="you@youremail.com">'; // Start the For Each loop $i = 0; foreach ($_SESSION["cart_array"] as $each_item) { $item_id = $each_item['item_id']; $sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1"); while ($row = mysql_fetch_array($sql)) { $product_name = $row["product_name"]; $price = $row["price"]; $details = $row["details"]; $tax = $row["tax"]; } $pricetotal = $price * $each_item['quantity']; $cartTotal = $pricetotal + $cartTotal; setlocale(LC_MONETARY, "en_US"); $pricetotal = money_format("%10.2n", $pricetotal); // Dynamic Checkout Btn Assembly $x = $i + 1; $pp_checkout_btn .= '<input type="hidden" name="item_name_' . $x . '" value="' . $product_name . '"> <input type="hidden" name="amount_' . $x . '" value="' . $price . '"> <input type="hidden" name="quantity_' . $x . '" value="' . $each_item['quantity'] . '"> '; // Create the product array variable $product_id_array .= "$item_id-".$each_item['quantity'].","; // Dynamic table row assembly $cartOutput .= "<tr>"; $cartOutput .= '<td><a href="product.php?id=' . $item_id . '">' . $product_name . '</a><br /><img src="inventory_images/' . $item_id . '.jpg" alt="' . $product_name. '" width="40" height="52" border="1" /></td>'; $cartOutput .= '<td>' . $details . '</td>'; $cartOutput .= '<td>$' . $price . '</td>'; $cartOutput .= '<td><form action="cart.php" method="post"> <input name="quantity" type="text" value="' . $each_item['quantity'] . '" size="1" maxlength="2" /> <input name="adjustBtn' . $item_id . '" type="submit" value="change" /> <input name="item_to_adjust" type="hidden" value="' . $item_id . '" /> </form></td>'; //$cartOutput .= '<td>' . $each_item['quantity'] . '</td>'; $cartOutput .= '<td>' . $pricetotal . '</td>'; $cartOutput .= '<td><form action="cart.php" method="post"><input name="deleteBtn' . $item_id . '" type="submit" value="X" /><input name="index_to_remove" type="hidden" value="' . $i . '" /></form></td>'; $cartOutput .= '</tr>'; $i++; } ?> Edited November 19, 2012 by Zane Quote Link to comment Share on other sites More sharing options...
trq Posted November 19, 2012 Share Posted November 19, 2012 And your question is? Quote Link to comment Share on other sites More sharing options...
smallc28 Posted November 19, 2012 Author Share Posted November 19, 2012 What is the code for adding tax to a shopping cart for example I would like php to add 6% tax for every item that appears my shopping cart.. instead of me doing is manually....I hope this was clear enough Quote Link to comment Share on other sites More sharing options...
MDCode Posted November 19, 2012 Share Posted November 19, 2012 $price = "1"; $taxrate = ".06"; $gettax = $price * $taxrate; $total = $price + $gettax; Quote Link to comment Share on other sites More sharing options...
smallc28 Posted November 19, 2012 Author Share Posted November 19, 2012 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.