osCmax v2.5 User Manual
Results 1 to 3 of 3

Paypal_ipn and stock levels

This is a discussion on Paypal_ipn and stock levels within the Paypal forums, part of the Payment Modules category; Ok, I am aware that when using the paypal_ipn module, the order gets added to the DB before the customer ...

      
  1. #1
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default Paypal_ipn and stock levels

    Ok, I am aware that when using the paypal_ipn module, the order gets added to the DB before the customer goes to Paypal web site, but stock level doesn't go down *YET* on the purchased items.

    Then payment is done, customer is redirected to checkout_process.php, and stock gets sutracted, emails get sent, etc.

    Problem comes when the customer does not return to the store for whatever reason, that the item will be sold but stock won't be sutracted... I hope this won't be a big deal, and that most people will go back to the store after doing the payment.

    ---

    Ok, I went too fast. Checking out paypal_ipn.php I see that stock gets sutracted from there, AND emails also get sent from there, on function confirmation() which I suppose is called from checkout_process.php. I wouldn't even have noticed if it wasn't because I had modified the emails that get sent from checkout_process.php so the subject would be "EMAIL_TEXT_SUBJECT (# order number)" instead of just "EMAIL_TEXT_SUBJECT", and I noticed that my test purchases did not have the order number on the subject.

    Wonder why they would be sending the email from there, instead of leting checkout_process.php handle it...?


    I would say I am not even asking for anything on this post. What was the answer...? Oh well.

  2. #2
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default Re: Paypal_ipn and stock levels

    I guess there is a small bug/glitch on paypal_ipn.php , since it is using its own code to email the customer after the purchase is finished, it does not have a small change that "purchase without account" added on checkout_process.php, which makes the email received by the customer NOT have a link to an invoice.

    Since the customer has not created an account, he can not access an invoice on the store, but customers who purchase without account AND pay with paypal_ipn will get the link on their email.

    So the following code should be done on /includes/modules/payment/paypal_ipn.php on line 523:

    PHP Code:
    // lets start with the email confirmation
          
    $email_order STORE_NAME "\n" .
                         
    EMAIL_SEPARATOR "\n" .
                         
    EMAIL_TEXT_ORDER_NUMBER ' ' $order_id "\n" .
                         
    EMAIL_TEXT_INVOICE_URL ' ' tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO'order_id=' $order_id'SSL'false) . "\n" .
                         
    EMAIL_TEXT_DATE_ORDERED ' ' strftime(DATE_FORMAT_LONG) . "\n\n"
    Replace with:

    PHP Code:
    // lets start with the email confirmation
          
    $email_order STORE_NAME "\n" .
                         
    EMAIL_SEPARATOR "\n" .
                         
    EMAIL_TEXT_ORDER_NUMBER ' ' $order_id "\n";
    // IF ADDED: PWA - Add test for PWA - no display of invoice URL if PWA customer
    if (!tep_session_is_registered('noaccount')) {
          
    $email_order .= EMAIL_TEXT_INVOICE_URL ' ' tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO'order_id=' $order_id'SSL'false) . "\n";
    }
          
    $email_order .= EMAIL_TEXT_DATE_ORDERED ' ' strftime(DATE_FORMAT_LONG) . "\n\n"
    For code clean up, the following changes could also be made on /checkout_process.php on line 288:

    PHP Code:
    // lets start with the email confirmation
    // LINE ADDED: PWA - Add test for PWA - no display of invoice URL if PWA customer
    if (!tep_session_is_registered('noaccount')) {
      
    $email_order STORE_NAME "\n" .
                     
    EMAIL_SEPARATOR "\n" .
                     
    EMAIL_TEXT_ORDER_NUMBER ' ' $insert_id "\n" .
                     
    EMAIL_TEXT_INVOICE_URL ' ' tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO'order_id=' $insert_id'SSL'false) . "\n" .
                     
    EMAIL_TEXT_DATE_ORDERED ' ' strftime(DATE_FORMAT_LONG) . "\n\n";
      if (
    $order->info['comments']) {
        
    $email_order .= tep_db_output($order->info['comments']) . "\n\n";
      }
      
    $email_order .= EMAIL_TEXT_PRODUCTS "\n" .
                      
    EMAIL_SEPARATOR "\n" .
                      
    $products_ordered .
                      
    EMAIL_SEPARATOR "\n";
      } else {
      
    $email_order STORE_NAME "\n" .
                     
    EMAIL_SEPARATOR "\n" .
                     
    EMAIL_TEXT_ORDER_NUMBER ' ' $insert_id "\n" .
                     
    EMAIL_TEXT_DATE_ORDERED ' ' strftime(DATE_FORMAT_LONG) . "\n\n";
      if (
    $order->info['comments']) {
        
    $email_order .= tep_db_output($order->info['comments']) . "\n\n";
      }
      
    $email_order .= EMAIL_TEXT_PRODUCTS "\n" .
                      
    EMAIL_SEPARATOR "\n" .
                      
    $products_ordered .
                      
    EMAIL_SEPARATOR "\n";
      } 
    Replace with:

    PHP Code:
    // lets start with the email confirmation
      
    $email_order STORE_NAME "\n" .
                     
    EMAIL_SEPARATOR "\n" .
                     
    EMAIL_TEXT_ORDER_NUMBER ' ' $insert_id "\n";
    // IF ADDED: PWA - Add test for PWA - no display of invoice URL if PWA customer
    if (!tep_session_is_registered('noaccount')) {
      
    $email_order .= EMAIL_TEXT_INVOICE_URL ' ' tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO'order_id=' $insert_id'SSL'false) . "\n";
    }
      
    $email_order .= EMAIL_TEXT_DATE_ORDERED ' ' strftime(DATE_FORMAT_LONG) . "\n\n";
      if (
    $order->info['comments']) {
        
    $email_order .= tep_db_output($order->info['comments']) . "\n\n";
      }
      
    $email_order .= EMAIL_TEXT_PRODUCTS "\n" .
                      
    EMAIL_SEPARATOR "\n" .
                      
    $products_ordered .
                      
    EMAIL_SEPARATOR "\n"
    Anyway, if anyone could give me a good reason why on earth when a purchase is paid with paypal_ipn the order email gets sent from paypal_ipn.php instead of from checkout_process.php , I would like to hear.

  3. #3
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default Re: Paypal_ipn and stock levels


Similar Threads

  1. Fatal error: /paypal_ipn.php on line 521
    By monoxide in forum Paypal
    Replies: 6
    Last Post: 10-02-2007, 07:57 PM
  2. Errors with paypal_ipn
    By RobPrince in forum Paypal
    Replies: 4
    Last Post: 07-01-2007, 05:24 AM
  3. SEO Friendly urls on top levels only
    By aaanativearts in forum osCMax v2 Features Discussion
    Replies: 1
    Last Post: 05-10-2007, 06:08 PM
  4. Maximum Stock Quantity on Stock Page?
    By Dubious in forum osCMax v2 Features Discussion
    Replies: 0
    Last Post: 08-18-2006, 02:17 PM
  5. Search Box to have 2 levels..
    By ozstar in forum osCmax v2 Customization/Mods
    Replies: 1
    Last Post: 11-06-2005, 08:00 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
  •