That is the concept, yes
That is the concept, yes
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Concepts are great but when it comes to real life...
When I tried to implement the above using $orders->attach(), the entire store blanked! This puzzled me for a moment since the 'freeProduct' example in the Developers API Tutorial works on my system without any problem (or modification).
At first, I tried changing the $autoLoadConfig offset (aka 'action point'), in the config file, from 90 to 210, thinking that perhaps this has to do with the fact that $orders is not instantiated until offset 180. That didn't help (same exact white blank page).
So, after some research I came across this excellent thread: Use Of Notifiers - How To.
I then realized that, despite having different symptoms, I probably have the same exact problem: attempting to use a class ($orders) instead of the 'stub' notifier class, $zco_notifier. It is also the class that actually sends the notification. That solved the blanking problem!
So, I can now start working on the actual functionality of this observer.
OK, I got the update() method of the observer class to act upon email confirmation and to write something to a test text file.![]()
The only problem now is that... all $orders->fields[] elements seem to be empty.
Using SuperGlobals Plus I can see at the successful checkout page that the $orders->fields[] elements are there and contain valid and correct values. So it seems that by the time my observer class receives the NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL notification, the $orders->fields[] array has gone???
I will try tying my observer class to NOTIFY_HEADER_START_CHECKOUT_SUCCESS to see if I can intercept that $orders->fields ...
Thanks again Kobra & DrByte for all your help and guidance. It's fun to program in such great environment.
Daniel
Isn't the object named $order, not $orders ?
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
No, it is $orders, as can be seen in the attached image.
I am still lost as to why the contents of the $orders->fields[] array is empty or what is the proper stage to "snatch" it. I tried the following notificatications - to no avail:
NOTIFY_HEADER_START_CHECKOUT_SUCCESS
NOTIFY_HEADER_END_CHECKOUT_SUCCESS
NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL
I am still successful at writing test text (and variables) to the test file in upon any of the above notifications. However, the $orders->fields[] seems to be empty when I do that, since non of those fields get written to the file.
Any idea how to snatch correctly those $orders->fields[] values?
Thanks,
Daniel
A "queryFactoryResult" object is the returned data from a database query.
The actual order object that contains the data for the currently in-progress order while checkout_process is creating and storing an order, is $order.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.