
Originally Posted by
Ajeh
You could build in an automatic email into the orders class to send to the manufactuer of each product an email when their product(s) sell ...
Yes that is essentially what I'm trying to achieve.
I have added a contact_email field to the zen_manufacturers_info table and believe I can get a list of email addresses that need to be notified by running the following query....
Code:
select zm.manufacturers_name, zmi.contact_email, zpd.products_name from
zen_orders_products zop
inner join zen_products zp on ( zop.products_id = zp.products_id )
inner join zen_products_description zpd on ( zp.products_id = zpd.products_id )
inner join zen_manufacturers zm on ( zp.manufacturers_id = zm.manufacturers_id )
inner join zen_manufacturers_info zmi on ( zm.manufacturers_id = zmi.manufacturers_id )
where zop.orders_id = $zf_insert_id;
Would something like the following be ok...
Code:
$developers_query = "zm.manufacturers_name , zmi.contact_email, zpd.products_name from " .
TABLE_ORDERS_PRODUCTS . " zop inner join " .
TABLE_PRODUCTS . " zp on ( zop.products_id = zp.products_id ) inner join " .
TABLE_PRODUCTS_DESCRIPTION . " zpd on ( zpd.products_id = zp.products_id ) inner join " .
TABLE_MANUFACTURERS . " zm on ( zp.manufacturers_id = zm.manufacturers_id ) inner join " .
TABLE_MANUFACTURERS_INFO . " zmi on
where zop.orders_id = '" . (int)$zf_insert_id . "';
$developers_emails = $db->Execute($developers_query);
while (!$developers_emails->EOF)
{
zen_mail( $developers_emails->fields['manufacturers_name'], $developers_emails->fields['contact_email'],EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $developers_emails->fields['products_name'], 'checkout');
$developers_emails->MoveNext();
}
Is there a more efficient way to do this and is the best place at the bottom of the send_order_email() function?
Thanks.