Search the Community
Showing results for tags 'cart'.
-
Hello, I want to be able to list an item for at least $1000.00 dollars. But, in the subtotal column, the decimal point is not displayed in the correct place. For example: Your Shopping Cart I am able to start out with the decimal point in the hundreds column. I then add a lot of quantities and update. Everything works just fine; the subtotal is correctly updated. ITEM QTY PRICE SUBTOTAL OPTIONS cappuccino machine :: 4 cup capacity 9 $150.00 $1350.00 Move to Wish List Remove from Cart Your Shopping Cart But, when I start out with a decimal point in the thousands column. The subtotal seems to not grab the correct dollar amount. Instead it displays the decimal point in the ones column. How do I fix this? ITEM QTY PRICE SUBTOTAL OPTIONS cappuccino espresso machine :: Pure cappuccino delight! 1 $1,000.00 $1.00 Move to Wish List Remove from Cart
-
Firstly, an amazing book as usual! Your ability to break down code into English is invaluable and unparalleled! I am working on a site with sometimes limited inventory (perhaps as few as 4 of something). The client expects to sell in "bursts," ie, they send out an email, and people flood the site to purchase the items, effectively creating a race condition. Obviously, I can't have someone purchasing something that someone else has already purchased, so I have to remove it from the available stock as soon as possible. On the other hand, it is vital to the success of the system to minimize events where items are tied up in incomplete orders, ie, orders that have been placed but not cleared financially. I am not locked into paypal or any credit card authentication system for checkout yet, as choosing which to use largely depends on the resolution of this issue. At present, I feel that using a system like Authorize.net is my best bet, as I would have the chance to stop the sale right up until the moment that the user is submitting the financial data and thus making the sale final. My client would like to offer both paypal and on-site credit card payments, but is not insistent upon it. Any solutions or thoughts on this would be greatly appreciated.
- 8 replies
-
- stock
- checkout verification
-
(and 1 more)
Tagged with:
-
Hi, I have a problem with the example two:Coffee. I have downloaded the script from Larry's site and installed in my server: http://www.gbilling.com. When i click the link cart or wishlist,an error appear: An error occurred in script'/home/gbilling/public_html/gmuar02/wishlist.php' on line 80:mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given...... The Cart .php is like this: <?php // This file manages the shopping cart. // This script is begun in Chapter 9. // Require the configuration before any PHP code: require ('./includes/config.inc.php'); // Check for, or create, a user session: if (isset($_COOKIE['SESSION'])) { $uid = $_COOKIE['SESSION']; } else { $uid = md5(uniqid('biped',true)); } // Send the cookie: setcookie('SESSION', $uid, time()+(60*60*24*30)); // Include the header file: $page_title = 'Coffee - Your Shopping Cart'; include ('./includes/header.html'); // Require the database connection: require (MYSQL); // Need the utility functions: include ('./includes/product_functions.inc.php'); // If there's a SKU value in the URL, break it down into its parts: if (isset($_GET['sku'])) { list($sp_type, $pid) = parse_sku($_GET['sku']); } if (isset ($pid, $sp_type, $_GET['action']) && ($_GET['action'] == 'add') ) { // Add a new product to the cart: $r = mysqli_query($dbc, "CALL add_to_cart('$uid', '$sp_type', $pid, 1)"); // For debugging purposes: //if (!$r) echo mysqli_error($dbc); } elseif (isset ($sp_type, $pid, $_GET['action']) && ($_GET['action'] == 'remove') ) { // Remove it from the cart. $r = mysqli_query($dbc, "CALL remove_from_cart('$uid', '$sp_type', $pid)"); } elseif (isset ($sp_type, $pid, $_GET['action'], $_GET['qty']) && ($_GET['action'] == 'move') ) { // Move it to the cart. // Determine the quantity: $qty = (filter_var($_GET['qty'], FILTER_VALIDATE_INT, array('min_range' => 1))) ? $_GET['qty'] : 1; // Add it to the cart: $r = mysqli_query($dbc, "CALL add_to_cart('$uid', '$sp_type', $pid, $qty)"); // Remove it from the wish list: $r = mysqli_query($dbc, "CALL remove_from_wish_list('$uid', '$sp_type', $pid)"); } elseif (isset($_POST['quantity'])) { // Update quantities in the cart. // Loop through each item: foreach ($_POST['quantity'] as $sku => $qty) { // Parse the SKU: list($sp_type, $pid) = parse_sku($sku); if (isset($sp_type, $pid)) { // Determine the quantity: $qty = (filter_var($qty, FILTER_VALIDATE_INT, array('min_range' => 0)) !== false) ? $qty : 1; // Update the quantity in the cart: $r = mysqli_query($dbc, "CALL update_cart('$uid', '$sp_type', $pid, $qty)"); } } // End of FOREACH loop. }// End of main IF. // Get the cart contents: $r = mysqli_query($dbc, "CALL get_shopping_cart_contents('$uid')"); if (mysqli_num_rows($r) >= 1) { // Products to show! include ('./views/cart.html'); } else { // Empty cart! include ('./views/emptycart.html'); } // Finish the page: include ('./includes/footer.html'); ?> Wishlist.php <?php // This file manages the wish list. // This script is begun in Chapter 9. // Require the configuration before any PHP code: require ('./includes/config.inc.php'); // Check for, or create, a user session: if (isset($_COOKIE['SESSION'])) { $uid = $_COOKIE['SESSION']; } else { $uid = md5(uniqid('biped',true)); } // Send the cookie: setcookie('SESSION', $uid, time()+(60*60*24*30)); // Include the header file: $page_title = 'Coffee - Your Wish List'; include ('./includes/header.html'); // Require the database connection: require (MYSQL); // Need the utility functions: include ('./includes/product_functions.inc.php'); // If there's a SKU value in the URL, break it down into its parts: if (isset($_GET['sku'])) { list($sp_type, $pid) = parse_sku($_GET['sku']); } if (isset ($sp_type, $pid, $_GET['action']) && ($_GET['action'] == 'remove') ) { // Remove it from the wish list. $r = mysqli_query($dbc, "CALL remove_from_wish_list('$uid', '$sp_type', $pid)"); } elseif (isset ($sp_type, $pid, $_GET['action'], $_GET['qty']) && ($_GET['action'] == 'move') ) { // Move it to the wish list. // Determine the quantity: $qty = (filter_var($_GET['qty'], FILTER_VALIDATE_INT, array('min_range' => 1))) ? $_GET['qty'] : 1; // Add it to the wish list: $r = mysqli_query($dbc, "CALL add_to_wish_list('$uid', '$sp_type', $pid, $qty)"); // For debugging purposes: //if (!$r) echo mysqli_error($dbc); // Remove it from the cart: $r = mysqli_query($dbc, "CALL remove_from_cart('$uid', '$sp_type', $pid)"); // For debugging purposes: //if (!$r) echo mysqli_error($dbc); } elseif (isset($_POST['quantity'])) { // Update quantities in the wish list. // Loop through each item: foreach ($_POST['quantity'] as $sku => $qty) { // Parse the SKU: list($sp_type, $pid) = parse_sku($sku); if (isset($sp_type, $pid)) { // Determine the quantity: $qty = (filter_var($qty, FILTER_VALIDATE_INT, array('min_range' => 0)) !== false) ? $qty : 1; // Update the quantity in the wish list: $r = mysqli_query($dbc, "CALL update_wish_list('$uid', '$sp_type', $pid, $qty)"); } } // End of FOREACH loop. }// End of main IF. // Get the wish list contents: $r = mysqli_query($dbc, "CALL get_wish_list_contents('$uid')"); if (mysqli_num_rows($r) > 0) { // Products to show! include ('./views/wishlist.html'); } else { // Empty cart! include ('./views/emptylist.html'); } // Finish the page: include ('./includes/footer.html'); ?> Or Is the procedure problem? I cannot store the Procedure in my database. #1304 - PROCEDURE select_categories already exists ... Can anyone help me??Thank you very much!!!!