Hi wondering if someone can help me ! Please Etc.Etc (o:
What im trying to do is modify the Checkout module so when an order is "complete" it connects to my home PC/Server to get the "original" raw file to email to the checkedout customer.
The ways I have tried to approach this is running a PHP script to check the fields in the database and if completed it then constructs the email.
My other thought was to just trigger the event on receipt of the notification email.
Has anyone any ideas on how to approach this Theory and practice welcome (o:
I will buy pizza for the best answer and a crate of beer if somebody shows me the light.
Posts: 4342
This is actually pretty trivial, if you are competent with php and also know the Gallery2 API (worth learning, if you don't, imo):
All you need to do is....
1. Write a module that....
2. ... registers an Event Listener for the GalleryCheckout::transactionChange Event which ...
3. ... when triggered, checks the relevant Event's Data field, which holds an array which should contain a 'type' field which contains the value 'clear' - indicating payment cleared, and then looks in ...
4. ... the Event's Entity field which holds the TransactionEntity, from which you can get the relevant details of the order.
The code that posts the event is in GalleryCheckoutApi.class, I can't find the line number but it's in function changeTransactionStatus(), and you can see an example where changeTransactionStatus(...) is called in checkoutPaypal's IPN.inc in this bit of code which sets the Transaction status to "clear" if the incoming IPN indicates a payment has been made:
Enjoy!
Oh, I don't drink beer, but a bottle of a decent vintage Port is always welcome.
Posts: 4342
Somewhere in the Forum I wrote an entire module that was only 10 lines long I think, you could probably do the rest of what you want in another 10. There's your challenge - 20 lines of php or less.
Posts: 14
Hi Alec,
Cheers for that mate im trying to hack my way round with limited knowledge (o:
You got the location of the 10 lines of code you have actually done and ill try to get the rest done.
Pm me your paypal id (o:
Cheers mate
Posts: 4342
You want something like this, in a file called module.inc in a folder called (eg) 'checkoutfetchoriginals'
Notes:
1 - I haven't checked this for typos, missing braces etc
2 - I haven't actually checked that it works, at all, but this is the general idea
3 - This is the 'old' (deprecated) method of installing Event Handlers, but since there's not going to be a Gallery 2.4 ever, it doesn't matter much
4 - It's slightly over 20 lines
Posts: 14
Cheers let see if i can get it done thanks for your time alec
Posts: 4342
I put all that event stuff in checkout precisely to make it easy to do the kind of stuff you want to do. It would be nice to see someone make use of it!
Apart from me that is - obviously: every time I get an order, my server farm uses this mechanism automatically to transfer files to the drop folder that feeds into my array of Fuji Frontiers to print the pictures. In my dreams.