Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: order emails, How does it work?

    Quote Originally Posted by vandijkstef View Post
    I'm looking for a way to:
    - Still get the order in the database upon leaving ZC to a payment page.
    - NOT send the order confirmation. I'll call this function later on.
    The v1.5.x (and earlier versions) architecture of Zen Cart's checkout flow doesn't store the order in the db until after the payment module completes its steps.
    The normal flow is that the payment module runs its before_process() method to take the data from the payment page and submit it in real-time to the payment gateway (or receive the response from the offsite gateway after completing payment and returning to the site). Then optionally runs an after_process() method if present (often just to update internal logs, if anything at all).
    Then it writes the order to the database. The premise here is that only the orders that have been accepted by the payment process (ie: usually this means "payment received" or at least payment is pending because of a valid credit card authorization or the customer has agreed to send a check in the mail) actually make it into the database.
    Then it sends the email.
    Then it shows the checkout-success page to the customer.

    The money_order.php module is an example of allowing pending-payment orders to get saved.

    As for skipping the email confirmation, there's nothing in that part of the code to detect which payment method was used in order to take alternate action.
    As much as I hate using $GLOBALS, you could add a line to the beginning of the send_order_email() method of the order class to check something like
    Code:
    if ($GLOBALS[$_SESSION['payment']]->code == 'my_module_code_string') return;
    That would check the comparison against this line in your payment module:
    Code:
    $this->code = 'my_module_code_string';
    .

    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.

  2. #2
    Join Date
    Feb 2014
    Location
    Amsterdam, Netherlands
    Posts
    9
    Plugin Contributions
    1

    Default Re: order emails, How does it work?

    Now you mention, indeed my questions wasn't clear enough. Heat of the moment I suppose..

    This payment flow was really an unidentified part of ZC for me, thanks all for clearing this up! Really feel I'll get to a good solution with these answers

    To keep information (kinda) complete:
    I'm now working on a solution that involves some checking-code within the before_process(); (Which resides within the payment module). That code sets some flags to decide the rest of the processing. (My current module apparently immediatly accepts, if there are no errors, and then goes to it's gateway, emails already sent. It's not the best payment module around..)

 

 

Similar Threads

  1. v154 order emails work, contact us email form not working...
    By twitchtoo in forum General Questions
    Replies: 0
    Last Post: 30 Mar 2015, 09:39 PM
  2. v150 Custom Sort Order does not work
    By DeepGirl in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 6 Jun 2014, 04:22 PM
  3. Does PDF Order Center work with ZC1.3.5?
    By davale in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 4 Sep 2008, 03:37 AM
  4. Expected Sort order does not work
    By PeterBKK in forum General Questions
    Replies: 9
    Last Post: 25 Apr 2008, 10:46 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