Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,927
    Plugin Contributions
    4

    Default Re: Problem with "credit_covers"

    Hi,

    The problem here is we cannot just run the process function before the pre_confirmation as that would then set in stone all discounts, and then calculations would take place based on the reduced order totals.

    I did however come up with a fix, based solely on changing the pre_confirmation_check routine in the order_total class

    PHP 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($value0strrpos($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;
        }
      } 
    So although I have run the process function, i've restricted it to non Credit Class modules, and reset order totals after pre_confirmation_check finishes.

    This works on my up to date v1.3.8. Would appreciate some testing/feedback before I commit that as a bug fix.

  2. #2
    Join Date
    Jun 2007
    Location
    Phoenix, AZ
    Posts
    69
    Plugin Contributions
    0

    Default Re: Problem with "credit_covers"

    Quote Originally Posted by wilt View Post
    Hi,

    The problem here is we cannot just run the process function before the pre_confirmation as that would then set in stone all discounts, and then calculations would take place based on the reduced order totals.

    I did however come up with a fix, based solely on changing the pre_confirmation_check routine in the order_total class

    (snip)

    This works on my up to date v1.3.8. Would appreciate some testing/feedback before I commit that as a bug fix.
    Thanks, Wilt! I will apply this to my development site tonight and do some test runs

    Can I make a suggestion for 1.4? Perhaps the (returned) output from the process() function should be eliminated. Then you could break it into two functions: process() and output(). Then, process() could be called from the header_php file to set the discounts/additions in stone and it wouldn't matter when (or if) output() was called. In practice the new flow would go: process(), pre_confirmation_check(), output(). I know that would break existing order total modules, but hey, it's a major release!

    As an added bonus, it would also make it easier to display messages to the user using the global messageStack object. I worked around it by calling order_total->process() at the top of the template so that I could use messageStack to warn customers about low order fees, but I imagine there would be other uses as well.

    Thanks again, and I'll let you know how the testing goes....

  3. #3
    Join Date
    Jun 2007
    Location
    Phoenix, AZ
    Posts
    69
    Plugin Contributions
    0

    Default Re: Problem with "credit_covers"

    Quote Originally Posted by wilt View Post
    This works on my up to date v1.3.8. Would appreciate some testing/feedback before I commit that as a bug fix.
    Hi Wilt,

    I've also done some preliminary testing and this works for me as well. I plan to add some logging statements to it and move it to production this week. I'll let you know if I run into any issues.

    Thanks again for your help!

 

 

Similar Threads

  1. Replies: 2
    Last Post: 29 Aug 2013, 02:00 PM
  2. New Install Zen Cart 1.3.8a " Done but with errors on page" ?
    By Straight Razor in forum General Questions
    Replies: 4
    Last Post: 24 Feb 2010, 10:44 PM
  3. Image Handler 2.0 Admin "Done But With Errors On Page"
    By beasleybub in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 13 Jul 2009, 08:38 PM
  4. Replies: 0
    Last Post: 15 Jan 2009, 06:57 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