- Posts: 38
- Thank you received: 0
Custom Email based on User Group
11 years 10 months ago #182184
by KeithBlow
Custom Email based on User Group was created by KeithBlow
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4.35
-- Browser(s) name and version -- : Chrome
Client needs the order, once submitted to go to a specific email address first that is not his own. However, it needs to be set based on a product category (or associated user group) so it doesn't effect the rest of the site.
For example : Client (Company A) has his own client (Company
that can have employees log in and order products that are personalized just for them. However, once they order, the purchasing manager of Company B needs an email sent so they can approve it while Company A still receives the notification since their email address is set up in the HikaShop configuration.
Any chance this can be done?
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4.35
-- Browser(s) name and version -- : Chrome
Client needs the order, once submitted to go to a specific email address first that is not his own. However, it needs to be set based on a product category (or associated user group) so it doesn't effect the rest of the site.
For example : Client (Company A) has his own client (Company
Any chance this can be done?
Please Log in or Create an account to join the conversation.
11 years 10 months ago #182189
by nicolas
Replied by nicolas on topic Custom Email based on User Group
Hi,
It can be done with a small custom code addition of the order creation/status notification emails via the menu System>Emails:
It can be done with a small custom code addition of the order creation/status notification emails via the menu System>Emails:
Code:
<?php
$userGroups = JAccess::getGroupsByUser($data->customer->user_cms_id);
if(in_array(10,$userGroups)){
$data->customer->user_email .= ',manage@companya.com'; //for users in the user group with the id 10
}elseif(in_array(12,$userGroups)){
$data->customer->user_email .= ',manage@companyc.com'; //for users in the user group with the id 12
}
?>
Please Log in or Create an account to join the conversation.
11 years 9 months ago #183052
by KeithBlow
Replied by KeithBlow on topic Custom Email based on User Group
Where do I put the code? I put it in the preload section, at the bottom and now when I hit Finish on an order, it brings up a blank page, though the order is created.
Please Log in or Create an account to join the conversation.
11 years 9 months ago #183065
by Xavier
Replied by Xavier on topic Custom Email based on User Group
Hi,
Please set the error reporting level to "maximum" this will display the php error present in the blank page and give us more details on this error.
Please set the error reporting level to "maximum" this will display the php error present in the blank page and give us more details on this error.
Please Log in or Create an account to join the conversation.
11 years 9 months ago #183238
by KeithBlow
Replied by KeithBlow on topic Custom Email based on User Group
Turning it on gave me a clue to what the error is and I fixed it, however, when I do submit the order (the email portion works) but I get this error on the page:
And a box pops up and says:
Code:
Warning: explode() expects parameter 2 to be string, array given in path/libraries/joomla/string/punycode.php on line 209
And a box pops up and says:
Please Log in or Create an account to join the conversation.
11 years 9 months ago #183310
by nicolas
Replied by nicolas on topic Custom Email based on User Group
These are not errors from HikaShop.
For the first one, you can turn off the "error reporting" option of the Joomla configuration and that will remove it.
For the box popup up, I don't know where that comes from.
For the first one, you can turn off the "error reporting" option of the Joomla configuration and that will remove it.
For the box popup up, I don't know where that comes from.
Please Log in or Create an account to join the conversation.
Time to create page: 0.186 seconds