Jump to content

Cart Checkout Problem


J.Silver

Recommended Posts

Dear Sirs,

I have an e-commerce program that is complete in all of its aspects but cannot pass the cart page—unable to Checkout to the next page. I am able to log into the site via either http or https protocols. In https, e.g., I can move through the index page, catalogue, browse, shopping, wish list, & cart pages. The cart page itself functions properly as designed in the sense of adding items, removing items to the wish list, deleting items, provision of correct product and shipping costs, and amending quantities.  The only problem is when clicking the Checkout, it does not proceed to next page but rather gives error message. In IE it gives ‘Internet Explorer Cannot Display the Webpage.’ In Chrome, it does the same but the message is error 105, and in FF the error is server is not available.

Working URLs:  https://final.local/ https://final.local/browse/coffee/Kona/3 https://final.local/cart.php

Not working URL (the URL which gives above error messages):  https://www.final/local/checkout.php?session=9a31881e6c08e8277b133e22794a0042

Header, footer¸ and other includable files are included properly as per design. I have included both cart files, and would highly appreciate any suggestions/amendments to enable me Checkout from the cart page. Many thanks

 

cart.html

Note: begins with normal html view and table (not included here), which appears as designed.

</table><br /><p align="center"><input type="submit" value="Amend Quantity" class="button" /></form></p><br /><p align="center"><a href="https://<?php echo BASE_URL; ?>checkout.php?session=<?php echo $uid; ?>" class="button">Checkout</a></p></div>

Note: ends with the normal html view (not included here), which appears as designed.

 

cart.php

<?php

require ('./includes/config.inc.php');

if (isset($_COOKIE['SESSION'])) {

        $uid = $_COOKIE['SESSION'];

} else {

$uid = md5(uniqid('biped',true));

}

setcookie('SESSION', $uid, time()+(60*60*24*30));

$page_title = 'Your Shoppping Cart’;

include ('./includes/header.html');

require (MYSQL);

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)");

} 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.

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) > 0) { // Products to show!

include ('./views/cart.html');

} else { // Empty cart!

include ('./views/emptycart.html');

}

include ('./includes/footer.html');

?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.