Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Location
    SF Bay Area
    Posts
    877
    Plugin Contributions
    1

    Default Applies to FEC and PP Express Checkout - Checkout with insufficient stock

    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:

    Code:
    /**
     * handle Express Checkout processing:
     */
    if (isset($_GET['type']) && $_GET['type'] == 'ec') {
      // this is an EC handler request
      require('includes/application_top.php');
    and just BELOW that, add the stock check code:

    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;
          }
        }
      }
    Now for FEC fix...

    in includes/modules/pages/no_account/header_php.php find:

    Code:
    // redirect to homepage if no products in cart
    if (!$_SESSION['cart']->count_contents() >= 1) {
      zen_redirect(zen_href_link(FILENAME_DEFAULT, '', 'NONSSL'));
    }
    and just BELOW that, add the stock check code:

    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;
          }
        }
      }
    Now at least in these two places, no more checking out with not enough stock.

    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

  2. #2
    Join Date
    Jul 2006
    Location
    SF Bay Area
    Posts
    877
    Plugin Contributions
    1

    Default Re: Applies to FEC and PP Express Checkout - Checkout with insufficient stock

    One quick note for FEC users.

    I think you can put the same inventory check code into:

    includes/modules/pages/login/header_php.php

    On site I am working on, this is bypassed (no option to create account at all)

    So I think for more standard FEC, the file I mention above would be the proper place.

    probably right AFTER:

    Code:
    // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
    if ($session_started == false) {
      zen_redirect(zen_href_link(FILENAME_COOKIE_USAGE));
    }

  3. #3
    Join Date
    Jan 2004
    Posts
    58,260
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Applies to FEC and PP Express Checkout - Checkout with insufficient stock

    Insomuch as the PayPal code is affected, the code for v1.3.9 will be updated to have Express Checkout do a stock check before commencing checkout.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Error 10408 Express Checkout token is missing.
    By explorer1979 in forum PayPal Express Checkout support
    Replies: 11
    Last Post: 5 May 2011, 03:55 AM
  2. Text on Checkout page above express checkout
    By burko in forum PayPal Express Checkout support
    Replies: 3
    Last Post: 12 Apr 2011, 01:40 AM
  3. Replies: 11
    Last Post: 16 May 2009, 04:45 PM
  4. PayPal Express Checkout no checkout confirmation
    By amentes in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 9 Sep 2008, 09:20 AM
  5. Paypal Express checkout don't show button after installing Google Checkout
    By jgarabot in forum PayPal Express Checkout support
    Replies: 9
    Last Post: 2 Apr 2007, 07:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •