osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Features Discussion > Payment Modules > Paypal

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack (1) Thread Tools
  1 links from elsewhere to this Post. Click to view. #1  
Old 10-03-2007, 01:08 PM
MindTwist's Avatar
Active Member
 
Join Date: Jun 2007
Location: Barcelona, Spain
Posts: 261
Thanks: 7
Thanked 21 Times in 20 Posts
Rep Power: 3
MindTwist will become famous soon enoughMindTwist will become famous soon enough
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.
__________________
MindTwist of Twisted Reality and Twisted Tienda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 10-04-2007, 12:01 AM
MindTwist's Avatar
Active Member
 
Join Date: Jun 2007
Location: Barcelona, Spain
Posts: 261
Thanks: 7
Thanked 21 Times in 20 Posts
Rep Power: 3
MindTwist will become famous soon enoughMindTwist will become famous soon enough
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.
__________________
MindTwist of Twisted Reality and Twisted Tienda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 10-04-2007, 12:12 AM
MindTwist's Avatar
Active Member
 
Join Date: Jun 2007
Location: Barcelona, Spain
Posts: 261
Thanks: 7
Thanked 21 Times in 20 Posts
Rep Power: 3
MindTwist will become famous soon enoughMindTwist will become famous soon enough
Default Re: Paypal_ipn and stock levels

OPS... Micheal please edit my typo on the issue summary I opened on the bugtracker... payed=paid

235: Purchases done by customer without account get an invoice link on order email if payed with paypal_ipn - Bug Tracker - open source Commerce Maximized :: osCMax
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.oscmax.com/forums/paypal/10907-paypal_ipn-stock-levels.html

Posted By For Type Date
235: Purchases done by customer without account get an invoice link on order email if payed with paypal_ipn - Bug Tracker - open source Commerce Maximized :: osCMax This thread Refback 10-04-2007 12:37 PM

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Fatal error: /paypal_ipn.php on line 521 monoxide Paypal 6 10-02-2007 07:57 PM
Errors with paypal_ipn RobPrince Paypal 4 07-01-2007 05:24 AM
SEO Friendly urls on top levels only aaanativearts osCMax v2 Features Discussion 1 05-10-2007 06:08 PM
Maximum Stock Quantity on Stock Page? Dubious osCMax v2 Features Discussion 0 08-18-2006 02:17 PM
Search Box to have 2 levels.. ozstar osCMax v2 Customization/Mods 1 11-06-2005 09:00 AM


All times are GMT -8. The time now is 11:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
Copyright 2008 osCMax