PDA

View Full Version : Bypass inventory level validation in checkout


siteontime
06-02-2009, 09:19 PM
How can I bypass the inventory level validation process on the checkout page. I am passing product from 2 different databases into the cart and one of them does not track inventory levels so it is changing the cart quantity to 0 on those items. Everything I take out seems to put the checkout process into a loop. It appears that it thinks the cart is empty.

Thanks for your help.

Ray Borduin
06-03-2009, 06:12 AM
You can remove the loop that does the inventory checking on that page and the confirm page. It should appear on top of the pages and should be relatively easy to spot.

siteontime
06-03-2009, 08:36 AM
I have tried to remove several places where it was checking inventory, but when I remove it the checkout no longer works and it gets stuck in a loop. Can you tell me which lines to remove?

Ray Borduin
06-03-2009, 08:46 AM
I think the code you need to remove is on the confirm page.

It will be near the top... on the confirm page it looks like:


<?php
while (!$WA_Store_Cart->EOF()) {
?>
<?php
$_GET['CurCartID'] = $WA_Store_Cart->DisplayInfo("ID");
?>
<?php
$IDParam_WADAProducts = "-1";
if (isset($_GET['CurCartID'])) {
$IDParam_WADAProducts = (get_magic_quotes_gpc()) ? $_GET['CurCartID'] : addslashes($_GET['CurCartID']);
}
mysql_select_db($database_localhost, $localhost);
$query_WADAProducts = sprintf("SELECT products.*, (ProductStock - (SELECT Coalesce(Sum(DetailQuantity),0) FROM orderdetails INNER JOIN orders ON OrderID = DetailOrderID WHERE DetailProductID = ProductID AND OrderDate > ProductUpdateDate)) * ProductLive AS NumLeft FROM products LEFT OUTER JOIN productcategories ON ProductCategoryID = CategoryID WHERE ProductLive <> 0 AND ProductID = %s", GetSQLValueString($IDParam_WADAProducts, "int"));
$WADAProducts = mysql_query($query_WADAProducts, $localhost) or die(mysql_error());
$row_WADAProducts = mysql_fetch_assoc($WADAProducts);
$totalRows_WADAProducts = mysql_num_rows($WADAProducts);
?>
<?php
if ($row_WADAProducts['NumLeft'] < $WA_Store_Cart->DisplayInfo("Quantity") && $row_WADAProducts['ProductUnlimited'] == false) {
header("Location: cart.php");
}
?>
<?php
$WA_Store_Cart->MoveNext();
}
$WA_Store_Cart->MoveFirst();
?>

siteontime
06-08-2009, 11:09 AM
Thanks Ray, I removed on the checkout page, but did not realize it was also on the confirm. I appreciate the help.