Zen Cart Logo
Forums / PayPal Express Checkout support / reduce inventory in external system after payment is confirmed by Paypal?

reduce inventory in external system after payment is confirmed by Paypal?

Views: 4,760

Results 1 to 5 of 5
19 Mar 2011, 9:21 AM
#1
rovi1 avatar

rovi1

New Zenner

Join Date:
Mar 2011
Posts:
2
Plugin Contributions:
0

reduce inventory in external system after payment is confirmed by Paypal?

I am using a new install of v1.3.9h and default PayPal Express Checkout. When a payment gets processed, I get the updates back as expected in the Zen cart system. I understand payment is processed by ipn_main_handler.php, and I am assuming that the IPN notification from Paypal comes back to this php such that it updates tables PAYPAL, PAYPAL_PAYMENT_STATUS_HISTORY, ORDERS_STATUS_HISTORY, etc.
Now, I have a custom inventory management system for my retail store that got evolved over years. What I need is that when a product gets sold on my Zen cart website, it should automatically update my inventory management system. I have created a url that can be called with a parameter for the product id that gets sold. For illustration: http://www.myinventoryurl.com/updateinventory.jsp?id=101 which, when called, will reduce the quantity of 101 by 1.
I need to understand where can I call this url ( in ipn_main_handler.php? - I don't see the product ids in the order available in this code) and how such that I can pass the product ids to the url and call it for each item.
And, because we are at it, will I call the url like this example (I don't know much php)?
$page = file_get_contents("http://www.domain.com/filename");

Alternatively, could I could use triggers on mysql database table (orders_products?) to call the url. But I am not sure if I can call urls when using triggers.

If there is any plugin, or other approach available, I will appreciate, since I am sure I must not be the first person with a requirement like this, but unfortunately can't find any info on this.

Thanks in advance!

19 Mar 2011, 9:29 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: reduce inventory in external system after payment is confirmed by Paypal?

Better would be to inject your call into the order.php class in the same place that Zen Cart would decrement its own stock record when the product is sold.

19 Mar 2011, 9:41 AM
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: reduce inventory in external system after payment is confirmed by Paypal?

I am sure I must not be the first person with a requirement like this, but unfortunately can't find any info on this.
You are correct but due to the fact that there is not a standard second inventory system that all use it is custom coded for each

19 Mar 2011, 9:13 PM
#4
rovi1 avatar

rovi1

New Zenner

Join Date:
Mar 2011
Posts:
2
Plugin Contributions:
0

Re: reduce inventory in external system after payment is confirmed by Paypal?

Thanks kuroi for the clue. Any chance I could get an example from order.php showing how and exactly where to make the call (a generic example would suffice)?
Thanks in advance.

19 Mar 2011, 9:16 PM
#5
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: reduce inventory in external system after payment is confirmed by Paypal?

If you take a look at the stock by attributes add-in, it adds extra code to update it's own attribute level table. That would be the right place for you to put your external call instead.