Jump to content
Larry Ullman's Book Forums

Removing Products On The Checkout.Php Page


Recommended Posts

I am having a problem with the stock management option. When I add an item to the shopping cart and have more stock than is available, when proceeding tot he shopping cart, the item gets removed from the shopping cart and added to the wish list. When I do this with two items, only one of the items gets removed from the shopping cart and added to the wish list. I have changed the variables, but everything else is working in both the shopping cart and wish list. Any help would be appreciated. Thanks.

 

// Remove any problematic items:

if (!empty($remove)) {

 

// Clear the results:

mysqli_next_result($dbc);

 

// Loop through the array:

foreach ($remove as $sku => $qty) {

 

list($sp_type, $pid) = parse_sku($sku);

 

// Move it to the wish list:

$r = mysqli_multi_query($dbc, "CALL addToWishList_sku3('$uid', $pid, '$sku', '$sp_type', $qty);CALL removeFromCart_sku2('$uid', '$sku')");

echo "CALL addToWishList_sku3('$uid', $pid, '$sku', '$sp_type', $qty);CALL removeFromCart_sku2('$uid', '$sku')";

} // End of FOREACH loop.

 

} // End of $remove IF.

 

This is what is printed on the page when I add two items that don't have enough stock to fullfil the order:

CALL addToWishList_sku3('3e8413de30798552f88f6f33b533a0be', 4, 'O4', 'other', 127);CALL removeFromCart_sku2('3e8413de30798552f88f6f33b533a0be', 'O4')CALL addToWishList_sku3('3e8413de30798552f88f6f33b533a0be', 3, 'O3', 'other', 127);CALL removeFromCart_sku2('3e8413de30798552f88f6f33b533a0be', 'O3')

 

I have noticed when I add to many items to the example shopping cart that they both get removed from the shopping cart and added to the wish list. This isn't happening on my site. They aren't both removed until you procede to the billing page. Is there something in the code that I am missing?

 

I am using:

PHP Version 5.2.14

MYSQL 5.0.77

Link to comment
Share on other sites

  • 3 weeks later...

I'm so sorry for not replying earlier. I put this on my "content to follow" list because I couldn't get to it immediately, and then I forgot to check my "content to follow"! Sincere apologies. Are you still having problems with this?

Link to comment
Share on other sites

 Share

×
×
  • Create New...