I’ve found a couple of bugs with this, otherwise excellent, module:
- If you are not logged in Zen Cart will allow you to progress to the login page even if you have ignored the ‘delete out-of-stock’ products message on the shopping cart page. This may not seem a big deal, as you can’t progress further, but from a user experience perspective it’s definitely not ideal.
- If there is an out-of-stock product in your cart, all subsequent products you add will also be flagged as out-of-stock whether or not this is true.
Fortunately both issues were easy to fix with a little digging.
Issue 1 involves a modification to /includes/modules/pages/checkout_shipping/header_php.php.
Simply move the block of code under
// Stock Check
until it is above the section beginning with
// if the customer is not logged on, redirect them to the login page
This will force the page to check for stock before redirecting to the login page.
Issue 2 needs a small addition to
/includes/modules/pages/shopping_cart/header_php.php
Look for this section around line 59:
$flagAnyOutOfStock = false;
$products = $_SESSION[‘cart’]->get_products();
for ($i=0, $n=sizeof($products); $i$n; $i++) {
if (($i/2) == floor($i/2)) {
Change it to read:
$products = $_SESSION[‘cart’]->get_products();
for ($i=0, $n=sizeof($products); $i$n; $i++) {
$flagStockCheck = false;
if (($i/2) == floor($i/2)) {
This will force a reset of the flag for each iteration of the loop which builds the product array.