Add message integration to provide a tracking notification message type as well as default message type, view, rule event, etc.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nvahalik created an issue. See original summary.

nvahalik’s picture

Status: Active » Needs review
FileSize
16.56 KB
nvahalik’s picture

FileSize
16.87 KB

Updated the rule to have the proper condition. It checks for the commerce_shipments field and fires only if it has changed.

michfuer’s picture

Status: Needs review » Needs work

The default message type looks good. The Rule to send the message should trigger when a shipment has been shipped, e.g. if shipment_status == shipped AND shipment_previous_status != shipped, send notification.

Also I'm not sure what value the View brings? It seems like something a competent site builder could construct in a short period of time.

nvahalik’s picture

I agree with you on the rule. The message rule should trigger if a shipment has been added and it has a tracking number OR if a tracking number on a shipment has changed. The tracking number being added is easy but something different will be required for the updated tracking numbers. There are no revision numbers and no internal state that appears to change when a shipment is changed. The order gets a new revision but is there a way to tell if the shipment tracking number has been updated from the commerce_order update hook?

Also, I'm not sure what you mean about the view... it's required for the token to render tracking numbers.

michfuer’s picture

I didn't realize that about the View. My bad Nick. I still think leaving the View out will give the merchant more flexibility since they might want to config/style the line items separately from the tracking number.

In regards to the Rule it would be simpler to have a checkbox on the shipment edit form saying "Send shipment notification to order owner". This way it's explicit when the merchant is going to send a notification, and they don't need to learn about the underlying logic.

nvahalik’s picture

The view has to stay in otherwise the default notification message won't work. If someone doesn't like the view they can still override it just like they can with any other view that gets provided by default.

Will get back with a patch for the proper notifications.

nvahalik’s picture

Status: Needs work » Needs review
FileSize
21.39 KB

Attached patch adds a new rules event to trigger the sending of the email. It does this by manually checking the IEF field to see if it gets added. The rule is also update to use the new event which is defined the rules.inc file.

nvahalik’s picture

Status: Needs review » Postponed

I'm moving this over to a sandbox for further development: Commerce Shipment Message Integration