Skip to main content

different admin email per product

14 years 7 months ago #46118 by Schrijfklasje
hi,
I see your customization feature of emails in the configuration. Hope you can help me with this:

Customers buy product "x hours thesishelp from one of my teachers", I want an email sent to me AND the teacher after succesful order of the product. How can I make this happen, I receive email as admin/owner: yes. But how can I add an automatic notification email to the specific teacher?
I guess I need to make a hidden extra field with the product: the emailaddress of the teacher. And then to include a PHP statement to fetch that email in the Configuration/emails/Order administrator notification.
Would you be able to write some php for this?

Thank you,
Damiaan

Please Log in or Create an account to join the conversation.

14 years 6 months ago #46205 by nicolas
Hi,

There is a thread here www.hikashop.com/en/forum/4-how-to/23622...multiple-people.html about sending the order status notification to several people.

so you could do something similar. But instead of adding the emails manually, you would add them dynamically based on the custom field of the product:
$class = hikashop_get('class.product');
$prod = $class->get($item->product_id);
$data->customer->user_email[]=$prod->contact_email;

with contact_email being the column name of your custom field.

Please Log in or Create an account to join the conversation.

14 years 6 months ago #46258 by Schrijfklasje
hi Nicolas,
sounds like a brilliant solution, will try it out the next days, thank you!
Damiaan

Please Log in or Create an account to join the conversation.

13 years 11 months ago #76355 by Schrijfklasje
hi, how do I combine the two advices in this thread?

//this is to send multiple emails//
<?php $data->customer->user_email = array($data->customer->user_email,'email2@mywebsite.com','email3@mywebsite.com'); ?>

//this to do that dynamically based on a custom field at the product page (different email per product)
$class = hikashop_get('class.product');
$prod = $class->get($item->product_id);
$data->customer->user_email[]=$prod->contact_email;

I tried putting the second in the array() - but that got me into troubles, thank you!

Please Log in or Create an account to join the conversation.

13 years 11 months ago #76554 by Jerome
Hi,

I don't know what you tried but,
Code:
$data->customer->user_email = array($data->customer->user_email,'email2@mywebsite.com','email3@mywebsite.com');
would create an array for the variable "user_email" and
Code:
$data->customer->user_email[] = $prod->contact_email;
add a new item (a new email) in this array (if the object "$prod" is loaded correctly).

What are your troubles ?

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: Schrijfklasje

Please Log in or Create an account to join the conversation.

Time to create page: 0.048 seconds
Powered by Kunena Forum