Mass actions: possible to insert database values in email body?

  • Posts: 215
  • Thank you received: 7
  • Hikaserial Subscription Hikashop Business
11 months 2 weeks ago #301069

Hello,
I have created a mass action to send an email to the site admin
every time a user buys a certain product.

I was wondering if it possible to insert in the "body data" field of the "send mail" action some
values retrieved from this product db column.

Specifically I need to send the values of 2 or 3 custom fields associated with the "item" table
which the user has to fill before purchasing this specific product (see nimb.ws/LdOjxU )

Thank you

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

  • Posts: 67440
  • Thank you received: 10006
  • MODERATOR
11 months 2 weeks ago #301083

Hi,

There is no option for that.
However, it's possible to achieve it with custom code by editing the massaction notification email via the menu System>Emails.
There, in the preload section, you should be able to get the data of the order in $data and from it, get the products of the order, etc to add new tags in $texts that you could then use in the html section of the email.
So if you're a developer and with what you can see already there and a few var_dumps and tests, it should not be a problem.

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

  • Posts: 215
  • Thank you received: 7
  • Hikaserial Subscription Hikashop Business
11 months 2 weeks ago #301101

Unfortunately I am not a developer, but good to know that it is doable.
What about the email subject thought? Is it easily doable to add at least the order number there? (I am still talking about the "send mail" action of the mass mail actions)

Thanks

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

  • Posts: 67440
  • Thank you received: 10006
  • MODERATOR
11 months 2 weeks ago #301104

No, it would require similar modifications to the preload section of the email.
It's a few lines of code, but still, it requires some developement.

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

  • Posts: 215
  • Thank you received: 7
  • Hikaserial Subscription Hikashop Business
11 months 2 weeks ago #301128

What about using
user.user_email
in the email subject or body?

In another topic you suggested this to insert into the "to address" field. Not sure if it would do anything by inserting it elsewhere though...
Could be a quick fix to help identify the order

UPDATE: tested, doesn't do anything

Last edit: 11 months 2 weeks ago by oloccina.

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

  • Posts: 67440
  • Thank you received: 10006
  • MODERATOR
11 months 2 weeks ago #301175

Hi,

The user.user_email "tag" is specifically for the "to adress" field. It can't work elsewhere.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum