I know that you go to app/design/backend/mail/templates to edit the E-mail that is sent out, however I am having a problem figuring out how to attach a CSV to that. I want to have it so that when a customer orders, the "options" are attached in a CSV file. I tried inserting the following code
$emailed = outputCSV($this->get_template_vars(‘$oi.product_options’);$fp = fopen()
int fputcsv ($fp)
$fileat_type = “text/csv”;
$myfile = “myfile.csv”;$to = “jarrod@hltlasers.com”;
$subject = ‘Order’;
$headers = ‘MIME-Version: 1.0’. “\r\n”;
$headers .= ‘Content-type :text/html; charset = iso-8859-1’ . “\r\n”;
mail($to, $subject, $emailed, $header);}
}
function outputCSV($data) {
$output = fopen(“php://output”, “w”);
foreach ($data as $row) {
fputcsv($output, $row); // here you can change delimiter/enclosure
}
fclose($output);
}?>
and then doing an include script on the invoice.tpl but that did not work. Any ideas?