- Posts: 45
- Thank you received: 0
Send confirmation mail to linked other adresses
- Squashtoppertje
-
Topic Author
- Offline
-- Joomla version -- : 3.4.1
Hi,
I need to get the following done. When a (b2b) customer orders products and gets a confirmation email, I also need to send that email(copy) to his account manager. What makes it more difficult is that different customers have different account managers. So I can not just add an address in the BCC field.
I want to add the emailadress and name of the account manager to the database. This could be the case:
Customer 1 orders > copy confirmation to email Account Manager A
Customer 2 orders > copy confirmation to email Account Manager A
Customer 3 orders > copy confirmation to email Account Manager B
Etc.
Do you have some tips how to get this done?
Thanks very much!
EDIT: I checked out this thread , but that didn't do the trick for me.
Please Log in or Create an account to join the conversation.
You can create a custom address field, display it or not in the frontend, fill its value and use this kind of code at the end of the preload part of the desired emails:
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
Please Log in or Create an account to join the conversation.
What custom address field ? Could you give more background on what you're talking about ?
How did you configure your custom field ? Could you do a screenshot ?
What you do enter in it for example ?
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
Well, I'm responding to the reaction of Xavier. He suggests to use a custom address field for my original question. But his answer is not clear (enough) for me.
This is what I like to accomplish:
When a (b2b) customer orders products and gets a confirmation email, I also need to send that email(copy) to his account manager. What makes it more difficult is that different customers have different account managers. So I can not just add an address in the BCC field.
I want to add the emailadress and name of the account manager to the database. This could be the case:
Customer 1 orders > copy confirmation to email Account Manager A
Customer 2 orders > copy confirmation to email Account Manager A
Customer 3 orders > copy confirmation to email Account Manager B
Etc.
Thanks for your support.
Please Log in or Create an account to join the conversation.
Why did you copy paste the content of your first message ?
Xavier told you to use an address custom field : but you can also use a "user custom field".
And because you want to store an email address ; I think that using a "text" will be just fine for the custom field type.
You can also use a dropdown and enter the different account managers ; it's up to you !
Now ; here the documentation for the custom fields :
www.hikashop.com/support/documentation/i...shop-field-form.html
Once you will know how you want your thing ; you'll decide which type of which kind of custom field you want to use.
If you have issues for the configuration or the email modification ; in that case you can reply to that thread and provide details about what you have already done.
But you asked how you could make that "BCC" address dynamic and Xavier gave you one solution.
I'm sorry if it was not clear enough for you but the solution was there ; and there is no need to asked once again the same question.
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.
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
I'm sorry, but I think this is a miss communication... Xavier did give me start, but unfortunately it was not completely clear to me. I gave the same information again because it seemed like Nicolas needed it.
But the point is that I do not want the customer to select his Account Manager. The system needs to do this without the customer seeing it. So I have to do some scripting to make it able to send the copy to the right account manager. The customers are in customer groups so I wanted to use this.
I'm thinking something like, in words, not code:
If customer = in customergroup A then BCC AM1@example.com;
if customer = in customergroup B then BCC AM2@example.com.
etc.
But I hope for some code to get me started and it was not clear to me where in the custom (address?) fields to place it.
Thanks again.
Please Log in or Create an account to join the conversation.
Then based on what you say you want to do, there is no need to talk about custom fields.
The line you need is this:
$this->mailer->addBCC('AM1@example.com');
Then, you can add additional code around it to check the user group of the customer.
You'll find many resources online for that since it's not something related to HikaShop but Joomla. For example:
forum.joomla.org/viewtopic.php?t=530721
So for example: <?php
jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($data->cart->customer->user_cms_id);
if(in_array(18,$groups)) $this->mailer->addBCC('AM1@example.com'); ?>
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
Well, I thought this over and decided to go for the solution Xavier provided after all. However, this does not seem to work.
What I did to test it was the following:
1. I added two custom fields, one addres field and one user field.
2. For a customer I filled these fields with an emailadres.
3. I added the code Xavier gave to the preload screen of the creation notification email.
4. Tested it, but no bcc mail was send (regular emails were send).
I added this code to the preload version:
I added the last line to see if this was beeing send, but this didn't happen. FYI: if I enter a global bcc email address in the settings of the email, this is beeing send. So it's not that the server doesn't allow it.
How can I get this to work?
Thanks!
Please Log in or Create an account to join the conversation.
This code from Xavier would only work if your custom field was of the table "order" (meaning that the customer would fill it during the checkout).
For custom user fields, you want to use such variable $data->customer->emailusercustom instead of $data->cart->emailusercustom
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
Don't know if your code is wrong, but like said in my previous mail this code does not seem to work:
$this->mailer->addBCC('AM1@example.com');
I have tested it to see if I got mail this way, but this did not happen. I put it in the preload-screen, at the end.
Are you sure this is right? Is there maybe another code to try, I really need this to work?
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
I also tried adding this code to the HTML-version of the e-mail, but no luck.
Furthermore I tried the following code in the preload version, but this throw a 500-error:
Don't know if this matters, as the basic $this->mailer->addBCC('AM1@example.com'); does not result in an extra mail?
Could you please assist me with this?
Thanks.
Please Log in or Create an account to join the conversation.
The 500 error is because $this->mail doesn't have any addBCC function, so you can't have that code.
But yes, that code should work.
Alternatively, you can try this one:
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
This works great. Thanks.
Please Log in or Create an account to join the conversation.
- Squashtoppertje
-
Topic Author
- Offline
- Posts: 45
- Thank you received: 0
Have you got any idea why and how to solve this?
Thanks!
Please Log in or Create an account to join the conversation.
Joomla 3.5.1 had some modifications in the mail system.
But latest version of HikaShop have all required patch to all it.
See :
www.hikashop.com/forum/checkout/883603-4...heckout-process.html
www.hikashop.com/forum/orders-management...tion-recipients.html
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.
Please Log in or Create an account to join the conversation.