different admin email per product

  • Posts: 48
  • Thank you received: 1
12 years 7 months ago #46118

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.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 7 months ago #46205

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.

  • Posts: 48
  • Thank you received: 1
12 years 7 months ago #46258

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.

  • Posts: 48
  • Thank you received: 1
12 years 2 days ago #76355

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.

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
12 years 1 day ago #76554

Hi,

I don't know what you tried but,

$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
$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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Schrijfklasje

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

Time to create page: 0.064 seconds
Powered by Kunena Forum