Log email sends to the relevant entity

Created on 24 December 2020, over 3 years ago
Updated 8 February 2024, 5 months ago

We need ability to log emails that are sent by Commerce email into order activity log. We need basic information, what email was sent, to who and when.
On the individual email configuration page, we need a boolean field that will control if that email is logged or not.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇦Ukraine khiminrm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇦Ukraine khiminrm

    @rszrama I've made changes in variable, methods names.
    I've used condition to check if there are log templates categories for the target entity type ID to show the checkbox.
    I've added description for the checkbox field.
    We can add some validation message for the email edit form that the log templates are not found.
    And we can add some watchdog log if the template is not created when we try to log the email.
    What do you think?

  • 🇺🇦Ukraine khiminrm

    I've added validation mentioned in my previous comment

  • Status changed to Needs review about 1 year ago
  • 🇮🇱Israel jsacksick

    Commerce already logs order related emails, is the code not generic enough to support Commerce emails?

  • 🇮🇱Israel jsacksick

    So the reason why Commerce core doesn't log the emails sent by Commerce Email atm is because it doens't have $params['order'] set. See https://git.drupalcode.org/project/commerce/-/blame/8.x-2.x/modules/log/....

    But we probably want to log the emails ourselves I suppose. Maybe we can add a flag to the params array that Commerce looks for to indicate that logging should be skipped (if not enabled).

  • Status changed to Fixed about 1 year ago
  • 🇺🇸United States rszrama

    This looks good to me! I've made some interface text adjustments prior to committing this (which bled over a little into moving both the queueing and logging checkboxes lower down the configuration form), but I appreciate the validation added. I think we'll just need to add documentation for how to define log templates outside of this module vs. try to use error messages and form help text to explain it all.

    Committing!

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 5 months ago
  • 🇮🇱Israel jsacksick

    I think we should have made the commerce_log integration optional... Right now it is required which isn't good as people that don't really want/need the log module shouldn't have to enable it just to use commerce_email...
    As soon as commerce_log is turned off, it's going to log add to cart / cart removal events etc.

Production build 0.69.0 2024