I'm loosing some hair today with sites using either or both PP Express checkout button and FEC module.
Applies to version 1.3.8
Other installed mods: Stock by Attribute 4.7 (not Multi or Ajax)
Symptom: Checkout is allowed with insufficient stock even with proper settings in admin--Stock ie: don't allow checkout.
To fix the PP Express problem: edit ipn_main_handler.php
Near the top, find the line that says:
and just BELOW that, add the stock check code:Code:/** * handle Express Checkout processing: */ if (isset($_GET['type']) && $_GET['type'] == 'ec') { // this is an EC handler request require('includes/application_top.php');
Now for FEC fix...Code:// Stock Check if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) { $products = $_SESSION['cart']->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) { zen_redirect(zen_href_link(FILENAME_SHOPPING_CART)); break; } } }
in includes/modules/pages/no_account/header_php.php find:
and just BELOW that, add the stock check code:Code:// redirect to homepage if no products in cart if (!$_SESSION['cart']->count_contents() >= 1) { zen_redirect(zen_href_link(FILENAME_DEFAULT, '', 'NONSSL')); }
Now at least in these two places, no more checking out with not enough stock.Code:// Stock Check if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) { $products = $_SESSION['cart']->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) { zen_redirect(zen_href_link(FILENAME_SHOPPING_CART)); break; } } }
Note: These changes work and make sense to me to solve a problem. I looked all over forum for similar fix and see nothing. But then search here isn't so good.
Be careful and happy hacking.
Kiddo






Bookmarks