ec_email_new_order order_idWhat it does:
Use this to send out the "New Order" email.Defined in: /web/philip/tcl/ecommerce-email.tcl
Source code:
set db [ns_db gethandle subquery] set selection [ns_db 1row $db "select u.email, to_char(confirmed_date,'MM/DD/YY') as confirmed_date, shipping_address, u.user_id from ec_orders, users u where ec_orders.user_id=u.user_id and order_id=$order_id"] set_variables_after_query set item_summary [ec_item_summary_in_confirmed_order $db $order_id] if { ![empty_string_p $shipping_address] } { set address [ec_pretty_mailing_address_from_ec_addresses $db $shipping_address] } else { set address "not deliverable" } set price_summary [ec_formatted_price_shipping_gift_certificate_and_tax_in_an_order $db $order_id] set customer_service_signature [ec_customer_service_signature] set system_url "[ec_insecure_url]" # have to get rid of ampersands in above variables because they # mess up regsubs regsub -all "&" $price_summary {\\&} price_summary regsub -all "&" $item_summary {\\&} item_summary regsub -all "&" $address {\\&} address regsub -all "&" $customer_service_signature {\\&} customer_service_signature regsub -all "&" $system_url {\\&} system_url # Note: template #1 is defined to be the "New Order" email set selection [ns_db 1row $db "select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id=1"] set_variables_after_query # and get rid of ctrl-M's in the body regsub -all "\r" $email_body "" email_body regsub -all "confirmed_date_here" $email_body $confirmed_date email_body regsub -all "item_summary_here" $email_body $item_summary email_body regsub -all "address_here" $email_body $address email_body regsub -all "price_summary_here" $email_body $price_summary email_body regsub -all "customer_service_signature_here" $email_body $customer_service_signature email_body regsub -all "system_url_here" $email_body $system_url email_body ns_db dml $db "begin transaction" # create a customer service issue/interaction/action set user_identification_and_issue_id [ec_customer_service_simple_issue $db "" "automatic" "email" "[DoubleApos "To: $email\nFrom: [ad_parameter CustomerServiceEmailAddress ecommerce]\nSubject: $email_subject"]" $order_id $issue_type_list $email_body $user_id] set user_identification_id [lindex $user_identification_and_issue_id 0] set issue_id [lindex $user_identification_and_issue_id 1] # add a row to the automatic email log ns_db dml $db "insert into ec_automatic_email_log (user_identification_id, email_template_id, order_id, date_sent) values ($user_identification_id, 1, $order_id, sysdate) " ns_db dml $db "end transaction" set email_from [ec_customer_service_email_address $user_identification_id $issue_id] ec_sendmail_from_service "$email" "$email_from" "$email_subject" "$email_body" ec_email_product_notification $db $order_id ns_db releasehandle $db