Tailoring the Order creation notifications emails

  • Posts: 217
  • Thank you received: 1
11 years 7 months ago #98123

hi all,

Depending on the product bought I want the Order creation notifications email address sent to different people.

How might I go about that?

Thanks,

Mat

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #98201

Hi,

You can edit the mail in question, and at the end of this mail check the products in the cart, and if product x send to y, if product a send to b, etc.
To add the addresses, you can use: $data->mail->dst_email .= ',' . 'This email address is being protected from spambots. You need JavaScript enabled to view it.';

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

  • Posts: 10
  • Thank you received: 0
11 years 6 months ago #101769

I was searching the Forum with the very same question, and found this topic.

Xavier, I have two questions for you:

1) Could you elaborate a bit more on your response? By that I mean, could you give us a better example of what you mean by "check the products in the cart"? I am quite proficient in PHP, but without the in-depth knowledge of the internals of HikaShop, it is quite difficult to understand what you mean by the specifically.

2) Wouldn't it be much simpler (and easier) to add this functionality as an enhancement to the configuration? This could be a simple as adding a "Order Notification Email Address" column to Brand, Category, and Product, which would allow such configuration to be as granular as is necessary, and during the course of the email generation to load an array of email recipients, and then eliminate the duplicates before finally addressing the email.

Question 2 is really more of an enhancement request. What Mat and I are suggesting is really quite a common occurrence, and adding the functionality I described would make for a great enhancement to your product.

Thanks and Regards,
David

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 6 months ago #101782

You can already do that with HikaMarket Multivendor.
With it, you can assign each product to a vendor and the vendor will be notified when a purchase of his products is made.
It's even better that the solution provided by Xavier because the vendor will only see his own products in the email notification. And using that feature, you don't need to edit any code.

Regarding the code, if you're already a developer, you should find quite rapidely how to loop through the products in the order for the check of who should receive a copy of the email by looking at the code already in the email.
Here is a simplified example :

foreach($data->cart->products as $item){ if($item->order_product_code=='my_prod'){ $data->mail->dst_email .= ',' . ' email@toadd.com'; } }

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

Time to create page: 0.061 seconds
Powered by Kunena Forum