PDA

View Full Version : Update Database After Puchase


purchase327552
04-24-2009, 09:04 AM
Any ideas how to use "Checkout Form Response" and "Get Contents From Form" to mark items as sold when returning from the merchant gateway? I'm pretty sure I could do it if I were dealing with single items, but I'm using a cart with PayPal's Website Payments Standard. I'm using eCart and have the Web Developer Suite, so I should have all the necessary kit - just the knowledge I'm lacking!

Any and all contributions gratefully received.

Ray Borduin
04-24-2009, 09:14 AM
The best way to do it is to use a hidden form element named custom on your confirm page and set it to the value of the orderID for this order.

Then use that value on your IPN page to update all of the associated records using the Update server behavior that comes with DataAssist.

purchase327552
04-24-2009, 10:27 AM
I don't really understand how to determine the item ID's from the OrderID. Could I use several custom form elements with an item ID each, or maybe a comma separated list which I could explode on the IPN page, using the Update Server behaviour as you suggest?

Ray Borduin
04-24-2009, 10:31 AM
Why not mark the whole order as valid, invalid instead of each individual item? Even if you want to update each individual item, you should have a central OrderID to identify the items in the same order somehow. Use that variable.

If you used the checkout wizard, the OrderID, is one of the fields in the OrderDetails table that you can use to identify all of the items in that order. It is stored as a session variable in the Store Cart Summary in Database server behavior.

purchase327552
04-24-2009, 11:25 AM
Why not mark the whole order as valid, invalid instead of each individual item?

Because I don't keep a record of transactions (since PayPal do that it just duplicates something that's already in place), I just want to remove items from the shop when they've been sold without having to do it manually.

If you used the checkout wizard, the OrderID, is one of the fields in the OrderDetails table that you can use to identify all of the items in that order. It is stored as a session variable in the Store Cart Summary in Database server behavior.

If this contains all the ID's I need then that would be great, but I don't understand how to get at them. Essentially all I need is a way to have the item ID's returned to me either individually or in an array, so I can run an update on the database.

Ray Borduin
04-24-2009, 11:27 AM
If you use "get contents from form" with "ipn shopping cart" selected it will repopulate your cart with the items that were in it. You can use the cart as your array.

purchase327552
05-12-2009, 06:38 AM
That's great, thanks. My main issue seems to have been not understanding the PayPal end of things, but I've boned up on that now and everything's working fine now.