Regular order notifications are great, but this module should also support separately sent admin-facing order notifications and a separate message type so that they can be customized.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | add_admin_order-2572767-5.patch | 3.98 KB | nvahalik |
Comments
Comment #2
nvahalik commentedComment #3
Christopher Riley commentedI too would love to see this be part of the official module however when I use your patch and then try to run an update I receive the following:
-> drush updb
No database updates required [success]
Creating default object from empty value entity.module:876 [warning]
WD message_type: EntityMalformedException: Missing bundle property on entity of type message_type. in entity_extract_ids() (line 7844 of [error]
/home/site/public_html/includes/common.inc).
exception 'EntityMalformedException' with message 'Missing bundle property on entity of type message_type.' in [error]
/home/site/public_html/includes/common.inc:7844
Stack trace:
#0 /home/site/public_html/modules/field/field.attach.inc(191): entity_extract_ids('message_type', Object(stdClass))
#1 /home/site/public_html/modules/field/field.attach.inc(914): _field_invoke('presave', 'message_type', Object(stdClass))
#2 /home/site/public_html/sites/all/modules/contrib/entity/includes/entity.controller.inc(912): field_attach_presave('message_type',
Object(stdClass))
#3 /home/site/public_html/sites/all/modules/contrib/entity/includes/entity.controller.inc(443): EntityAPIControllerExportable->invoke('presave',
Object(stdClass))
#4 /home/site/public_html/sites/all/modules/contrib/entity/includes/entity.controller.inc(949): EntityAPIController->save(Object(stdClass), NULL)
#5 /home/site/public_html/sites/all/modules/contrib/entity/entity.module(289): EntityAPIControllerExportable->save(Object(stdClass))
#6 /home/site/public_html/sites/all/modules/contrib/entity/entity.module(942): entity_save('message_type', Object(stdClass))
#7 /home/site/public_html/sites/all/modules/contrib/entity/entity.module(853): _entity_defaults_rebuild('message_type')
#8 /home/site/public_html/sites/all/modules/contrib/entity/entity.module(1080): entity_defaults_rebuild()
#9 [internal function]: entity_flush_caches()
#10 /home/site/public_html/includes/module.inc(895): call_user_func_array('entity_flush_ca...', Array)
#11 /home/site/public_html/includes/common.inc(7600): module_invoke_all('flush_caches')
#12 /usr/local/src/drush/commands/core/drupal/cache.inc(99): drupal_flush_all_caches()
#13 /usr/local/src/drush/includes/drush.inc(718): drush_cache_clear_both()
#14 /usr/local/src/drush/includes/drush.inc(705): drush_call_user_func_array('drush_cache_cle...', Array)
#15 /usr/local/src/drush/commands/core/cache.drush.inc(143): drush_op('drush_cache_cle...')
#16 [internal function]: drush_cache_command_clear('all')
#17 /usr/local/src/drush/includes/command.inc(368): call_user_func_array('drush_cache_com...', Array)
#18 /usr/local/src/drush/includes/command.inc(219): _drush_invoke_hooks(Array, Array)
#19 [internal function]: drush_command('all')
#20 /usr/local/src/drush/includes/command.inc(187): call_user_func_array('drush_command', Array)
#21 /usr/local/src/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#22 /usr/local/src/drush/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#23 /usr/local/src/drush/drush.php(11): drush_main()
#24 {main}
Finished performing updates. [ok]
I am sure there is just one thing that was overlooked but it isn't jumping out at me right now. Suggestions?
Comment #4
nvahalik commentedComment #5
nvahalik commentedFixed the import!
Comment #6
jimmynash commentedDoes this new message work with the !order_summary token? I'd love to have this new message in there but I've had troubles in the past with that token in the message. More here https://www.drupal.org/node/2366413
Comment #7
nvahalik commentedYes, it does support
!order-summary:I know there has been some discussion about opening that token up, but obviously that is out of scope for this ticket. ;)
Comment #8
mglamanWe have tests now, and we should add that. The tests have an example for ensuring a message is emailed.
Also, I'd like to get #2366413: !order-summary token not replaced in message types other than "commerce_order_order_confirmation" resolve so we don't need this logic check
Comment #10
mglamanI went and re-rolled nvahalik's patch. I also added tests to confirm the message gets sent.
Comment #13
wizonesolutionsFYI, there are some tokens that are serialized bad in the defaults here. Easy enough to fix manually, and I know this isn't the place to post, but.....just...mentioning it.
Comment #14
rob c commentedFor some reason this message is sent to the user and not the admin on a site i maintain after updating. (without changing the rule ofco). Would be nice to have a heads up for this in the docs, sites might start to mail to users without manual testing / changing the rule / other changes might impact this. From looking at the code i wonder: where does the admin email come in to play? Trying to trace back the why.