
Originally Posted by
kobra
You should be on the correct track with that and the correct file to start with
Thank you. After some learning, I managed to create an auto_loader config file in includes/auto_loader/ (first step required).
Then, the file containing the actual intelligence of my mod, needs to be created. It's an observer class file in includes/classes/observers/ in which the main trick, IMHO, is to find the right object to attach. After some learning and research (with the help of DrByte, thank you!) I concluded that that object should be 'orders' (please correct if I am wrong). Thus, the resulting observer.writecustinfo.php looks like:
PHP Code:
<?php
/**
* Observer class to write customer info to a temp file.
*/
class writecustinfo extends base {
/** constructor method !
* Attaches our class to the $orders class and watches for 1 notifier event.
*/
function writecustinfo() {
$orders->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL'));
}
/** Actual Method to write data to file
* Called by observed class when any of our notifiable events occur
*
* @param object $class
* @param string $eventID
*/
function writetofile(&$class, $eventID) {
/**
* Write the following fields to a file
*/
orders->fields[orders_id];
orders->fields[customers_id];
orders->fields[customers_name];
orders->fields[customers_company];
orders->fields[customers_street_address];
orders->fields[customers_suburb];
orders->fields[customers_city];
orders->fields[customers_postcode];
orders->fields[customers_state];
orders->fields[customers_country];
orders->fields[customers_telephone];
orders->fields[customers_email_address];
orders->fields[customers_address_format_id];
orders->fields[delivery_name];
orders->fields[delivery_company];
orders->fields[delivery_street_address];
orders->fields[delivery_suburb];
orders->fields[delivery_city];
orders->fields[delivery_postcode];
orders->fields[delivery_state];
orders->fields[delivery_country];
orders->fields[delivery_address_format_id];
orders->fields[billing_name];
orders->fields[billing_company];
orders->fields[billing_street_address];
orders->fields[billing_suburb];
orders->fields[billing_city];
orders->fields[billing_postcode];
orders->fields[billing_state];
orders->fields[billing_country];
}
}
?>
Does the above make sense at all?
Do you identify fundamental flaws in the code or in my understanding of the process?
(for simplicty, I didn't include the actual file writing code, I will start working on it shortly).
Thanks,
Daniel
Bookmarks