Send order created email to custom field email address

  • Posts: 10
  • Thank you received: 0
1 year 10 months ago #348197

-- HikaShop version -- : 4.7.0
-- Joomla version -- : 3.10.11

Hi,

I found this: www.hikashop.com/support/forum/4-how-to/...firmation-email.html which is similar to the issue I'm trying to deal with.

We have 2 warehouses and depending on the user, we'd like the order emails to go directly to the correct warehouse email address. I created a single drop-down custom field called 'dispatch' and set the value to the 2 different email addresses.

How do I get the order emails to use the value in the custom field to send the email?

Thanks for your help.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 10 months ago #348201

Hi,

You would have to first create a custom field of the table "order" and of the type "single dropdown" via the menu Display>Custom fields. In the DATA section, you would enter the email addresses in the "value" area and the name of the warehouses in the "title" area.
That way, the customer would be able to select the warehouse during the checkout.
Then, you can customize the emails via the menu System>Emails and add such code at the end of the preload section:

$mail->bcc_email = array($data->cart->xxx);
where xxx is the column name of your custom field. That way, a copy of the email will be sent to the email address selected by the customer.

Note however that since that thread, our solutions have evolved.
Now, with HikaMarket Multivendor, you could configure each warehouse as a vendor and activate the setting to allow the customer to select the vendor during the checkout with the "Allow vendor selector" setting:
www.hikashop.com/support/documentation/1...onfig_market_general
That way, you could do it without any customization.

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

  • Posts: 10
  • Thank you received: 0
1 year 10 months ago #348242

Hi,

This is close but a bit too far. We don't actually need the customer to pick the warehouse because the staff will set that in the backend. I've made a custom field: user_dispatch

I have put the emails in the 'Value' column.

Also, we don't really need to use CC/BCC, I rather that the email was sent directly to the right place rather than just copied to it with BCC.

Thanks again for your help.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 10 months ago #348243

Hi,

Then, in the order admin notiifcation, you should be able to do it by add this at the end of the preload section :

$data->customer->user_email = $data->cart->user_dispatch;

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

  • Posts: 10
  • Thank you received: 0
1 year 10 months ago #348290

Doesn't seem to be send the email, did I do something wrong?

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 10 months ago #348294

Hi,

Your custom field column name is not user_dispatch but dispatch, and it is in the "user" table, not the "order" table so you need to change the code to:

$data->customer->user_email = $data->customer->dispatch;

The following user(s) said Thank You: Adnohr

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

Time to create page: 0.068 seconds
Powered by Kunena Forum