Thanks yellow1912, that's exactly the kind of information I was looking for!
Thanks yellow1912, that's exactly the kind of information I was looking for!
I've been reading through the documentation for the API and testing a little observer class I made. I've also read through some forum posts, but I can't find the nugget of truth I'm looking for yet.The API examples hook into $_SESSION['cart'] and I want to hook into the checkout process. I'm assuming I need to use the NOTIFY_HEADER_END_CHECKOUT_SUCCESS event in my case.
What object do I attach to in my constructor function? I read some posts about using $zco_notifier, so I've tested a line like:
$zco_notifier->attach($this, array('NOTIFY_HEADER_END_CHECKOUT_SUCCESS'));
but nothing in my update() function seems to be getting triggered. In my update function I set up a query to $db to insert some data. Earlier, this worked when I hooked into $_SESSION['cart'] as a sanity check, but nothing happens when attempting to hook into $zc_notifier for the checkout success event. I also tried $this-attach which didn't work either.
I know I'm close, I just can't figure out how to structure my attach statement. Thanks in advance for any advice.
Bump...
Any ideas at all on this? I can't find any examples of how to hook a function into a successful checkout process. Perhaps I'm just not looking in the right place yet... :-(
Last edited by Gwixel; 17 May 2008 at 01:20 AM.
Look for SMS on Sale in the downloads area. This shows how to do what you're looking to do; you might want to put it earlier or later in the process, but at least you can get some ideas from looking at this.
Good luck,
Scott
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
OK, I guess I'm stumped... Looking at SMS on Sale was very helpful. What I need to do is get some info about the products purchased, parse that data and then use it to populate a table in another database. The first thing to figure out is how to get at the array (I'm assuming it's an array) of products purchased in the order. I've been searching the code for something resembling $order->info['products']... Is that where I should be looking, or is that info stored elsewhere?
Aha! I found it... The info I needed is found in $order->products['qty'] and $order->products['model'].
Thanks swguy. I think I may be onto something.... I've successfully attached a notifier using: $zco_notifier->attach($this, array('NOTIFY_HEADER_END_CHECKOUT_CONFIRMATION'));
It's not in the right place yet or doing what I want, but it's a start. I'll post another question if I get stumped...