Email "admin notification" depending on category
- stattgarde
-
Topic Author
- Offline
Less
More
14 years 11 months ago #28439
by stattgarde
Email "admin notification" depending on category was created by stattgarde
Hi!
Is it possible to send the admin notification on order creation to different email addresses depending on the categories the products of that order are in?
Or maybe any other filter I could use to achieve something like that?
Kind regards,
Simon
Is it possible to send the admin notification on order creation to different email addresses depending on the categories the products of that order are in?
Or maybe any other filter I could use to achieve something like that?
Kind regards,
Simon
Please Log in or Create an account to join the conversation.
14 years 11 months ago #28462
by nicolas
Replied by nicolas on topic Re: Email "admin notification" depending on category
Hi,
There is no option for that but it would be possible with some code customization of the email. If you know PHP, you can do that via the menu System->Emails in the Business edition.
You will have to first load the categories of the products in the order and then based on the categories, you can set the emails to which you want to send the email in the variable:
$data->customer->user_email = array('mail@company.com','mail2@company2.com');
There is no option for that but it would be possible with some code customization of the email. If you know PHP, you can do that via the menu System->Emails in the Business edition.
You will have to first load the categories of the products in the order and then based on the categories, you can set the emails to which you want to send the email in the variable:
$data->customer->user_email = array('mail@company.com','mail2@company2.com');
Please Log in or Create an account to join the conversation.
- stattgarde
-
Topic Author
- Offline
14 years 11 months ago #28473
by stattgarde
Replied by stattgarde on topic Re: Email "admin notification" depending on category
Thanks, that did the job.
For others to follow:
First I loaded the product class, then I iterated through the products in the order and loaded the category ids.
In these category ids I then searched for the desired id and if found I added a second email address.
Kind regards, Simon
For others to follow:
First I loaded the product class, then I iterated through the products in the order and loaded the category ids.
In these category ids I then searched for the desired id and if found I added a second email address.
Code:
$productClass = hikashop::get('class.product');
foreach ($data->cart->products as $product) {
$categories = $productClass->getCategories($product->product_id);
if (is_array($categories) && in_array($wantedCategoryId, $categories) {
$data->customer->user_email[] = $secondaryEmail;
break;
}
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.192 seconds