Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2009
    Posts
    21
    Plugin Contributions
    0

    Default Allowing a customer to complete checkout process with zero total order.

    I've run into an issue when using gift certificate, coupons, store credit, reward points and any combination thereof when I customer has applied these gimmicks to their order resulting in a $0.00 amount. The customer can no longer complete the checkout process because the payment options will not allow a $0.00 order. The freecharger module will not work because the base item is not free. The order total is the result of using the above gimmicks to get a free item.

    I would like to add a payment option in the list for a zero amount order so the customer can complete the order process.

    The only solution I've come up with so far is instructing the customer to choose check or money order.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Allowing a customer to complete checkout process with zero total order.

    Just for giggles and grins ... can you add this fix to your code ...
    http://www.zen-cart.com/forum/showth...333#post705333
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Mar 2009
    Posts
    21
    Plugin Contributions
    0

    Default Re: Allowing a customer to complete checkout process with zero total order.

    Ok, I made that change, but I don't see where it had any bearing on my issue.

    Everything is working as it should. I just don't have an option available for someone who has a zero total order.

    My payment options are check/money order, paypal express, and paypal IPN. If I use check/money order I can check out and the order gets sent to the queue for processing. Of course if I choose paypal, paypal rejects it because it's a zero total. If I don't choose anything I get the "payment method not selected error".

    Soooo, I either need to replicate the check/money order module and rename/re-function it to process the zero amount. Or I need to add an update button to the order total page that will take into account the gift certs, coupons, store credit, reward points, etc so that the freecharger module can come into play.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Allowing a customer to complete checkout process with zero total order.

    This is a totally experimental thought ...

    Try editing /includes/classes/payment.php. Around line 40 you'll see this:
    Code:
            if (zen_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and ($_SESSION['cart']->show_total()==0 and $_SESSION['shipping']['cost']== 0)) {
    Change it to:
    Code:
            global $order;
            if (zen_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and (($_SESSION['cart']->show_total()==0 || ($order->info['currency'] != '' && $order->info['total'] == 0)) and $_SESSION['shipping']['cost']== 0)) {
    Last edited by DrByte; 25 Mar 2009 at 08:27 PM. Reason: added missing closing parenthesis
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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.

  5. #5
    Join Date
    Mar 2009
    Posts
    21
    Plugin Contributions
    0

    Default Re: Allowing a customer to complete checkout process with zero total order.

    That edit resulted in the payment page rendering blank.

    Lines 39-58 in my file:

    Code:
           // Free Payment Only shows
            if (zen_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and ($_SESSION['cart']->show_total()==0 and $_SESSION['shipping']['cost']== 0)) {
    //global $order;
    //        if (zen_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and (($_SESSION['cart']->show_total()==0 || ($order->info['currency'] != '' && $order->info['total'] == 0) and $_SESSION['shipping']['cost']== 0)) { 
              $this->selected_module = $module;
              if (file_exists(DIR_FS_CATALOG . DIR_WS_MODULES . '/payment/' . 'freecharger.php')) {
                $include_modules[] = array('class'=> 'freecharger', 'file' => 'freecharger.php');
              }
            } else {
              // All Other Payment Modules show
              while (list(, $value) = each($this->modules)) {
                // double check that the module really exists before adding to the array
                if (file_exists(DIR_FS_CATALOG . DIR_WS_MODULES . '/payment/' . $value)) {
                  $class = substr($value, 0, strrpos($value, '.'));
                  // Don't show Free Payment Module
                  if ($class !='freecharger') {
                    $include_modules[] = array('class' => $class, 'file' => $value);
                  }
                }
              }
    You can see where I commented out the edit that rendered the page blank.

  6. #6
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,930
    Plugin Contributions
    4

    Default Re: Allowing a customer to complete checkout process with zero total order.

    Hi,

    Generally when using stock code and modules Zen Cart has no problems handling orders with zero value, even if you are using Paypal.

    There is logic to test the order total and skip even going to paypal if it is.

    I therefore suspect an incompatibility with some of the extra contributions you are using.

    That said, something similar has been noted before regarding contributed order total modules, and a fix was provided.

    The fix relates to the includes/classes/order_total.php file.

    You will need to replace this block of code

    Code:
      function pre_confirmation_check() {
        global $order, $credit_covers;
        if (MODULE_ORDER_TOTAL_INSTALLED) {
          $total_deductions  = 0;
          reset($this->modules);
          while (list(, $value) = each($this->modules)) {
            $class = substr($value, 0, strrpos($value, '.'));
            if ( $GLOBALS[$class]->credit_class ) {
              $order_total = $GLOBALS[$class]->get_order_total();
              if (is_array($order_total)) $order_total = $order_total['total'];
              $total_deductions = $total_deductions + $GLOBALS[$class]->pre_confirmation_check($order_total);
            }
          }
          $difference = $order->info['total'] - $total_deductions;
          if ( $difference <= 0.009 ) {
            $credit_covers = true;
          }
        }
      }
    with

    Code:
      function pre_confirmation_check() {
        global $order, $credit_covers;
        if (MODULE_ORDER_TOTAL_INSTALLED) {
          $total_deductions  = 0;
          reset($this->modules);
          $orderInfoSaved = $order->info;
          while (list(, $value) = each($this->modules)) {
            $class = substr($value, 0, strrpos($value, '.'));
            if ( $GLOBALS[$class]->credit_class ) {
              $order_total = $GLOBALS[$class]->get_order_total();
              if (is_array($order_total)) $order_total = $order_total['total'];
              $total_deductions = $total_deductions + $GLOBALS[$class]->pre_confirmation_check($order_total);
            }
            else 
            {
              $GLOBALS[$class]->process();
              $GLOBALS[$class]->output = array();
            }
          }
          $difference = $order->info['total'] - $total_deductions;
          if ( $difference <= 0.009 ) {
            $credit_covers = true;
          }
          $order->info = $orderInfoSaved;
        }
      }
    As with any code change, always make sure you backup any files being changed first.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Allowing a customer to complete checkout process with zero total order.

    Quote Originally Posted by sonjamichelle View Post
    That edit resulted in the payment page rendering blank.
    Ya, that's why I edited the post earlier to include the missing parenthesis.



    I recommend exploring wilt's input though.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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.

  8. #8
    Join Date
    Jun 2009
    Location
    Australia
    Posts
    2
    Plugin Contributions
    0

    Idea or Suggestion Re: Allowing a customer to complete checkout process with zero total order.

    I have experienced the inability to accept payment from any zone when processing a cart with $0.00 total value.

    My particular store is set up using a shipping module called - Static Shipping -

    The payment module is an add-on called - Offsite Payment -

    All other shipping and payment modules are defeated.

    When arriving at the checkout......

    A dialog comes up saying that "Sorry, we are not accepting payments from your region at this time" (Also seen at the thread http://www.zen-cart.com/forum/showth...pting+payments )

    Further, the confirmation email then insists on showing Gift Voucher/Coupon as the payment method.

    This payment method is consequently displayed when viewing any previous orders.

    My solution! ( ...based on only the two shipping and payment modules mentioned)

    ............in the file includes/classes/payment.php

    I commented out the following section of code.

    if (zen_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and ($_SESSION['cart']->show_total()==0 and $_SESSION['shipping']['cost']== 0)) {
    $this->selected_module = $module;
    if (file_exists(DIR_FS_CATALOG . DIR_WS_MODULES . '/payment/' . 'freecharger.php')) {
    $include_modules[] = array('class'=> 'freecharger', 'file' => 'freecharger.php');
    }
    } else

    Now this is done I am able to run $0.00 sales with the correct payment method.

    The code I commented out was preceeded by an existing comment which says ...

    // Free Payment Only shows

    I guess I may have achieved what I want but it could break the use of the freecharger module shown in the defeated code.

  9. #9
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Allowing a customer to complete checkout process with zero total order.

    Normal behavior is that the freecharger module must be enabled if you ever want to checkout when the balance is 0.00.
    So, simply undoing the changes you mention, and enabling the freecharger module should suffice.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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.

  10. #10
    Join Date
    Jun 2009
    Location
    Australia
    Posts
    2
    Plugin Contributions
    0

    bug Re: Allowing a customer to complete checkout process with zero total order.

    Thankyou Dr Byte,

    I've done as you said.

 

 

Similar Threads

  1. Replies: 2
    Last Post: 7 Jun 2012, 12:01 AM
  2. Customer Address not showing on order (or through the checkout process)
    By scamp in forum Managing Customers and Orders
    Replies: 8
    Last Post: 7 Feb 2010, 12:59 AM
  3. Order with no payment (Despite customer not completing checkout process)
    By BigNath in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 18 Dec 2009, 03:01 PM
  4. Zero total weight in Cart not allowing to proceed to step 2
    By jpuckey in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 16 Jul 2006, 11:43 PM

Posting Permissions

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