This is probably a dumb question, but I can't figure out what method to use to display the e-mail address associated with the customer's order on the actual Order View. The only way I can see it in the UI is to click "Edit" and then scroll down to the bottom of the page and look in User Information.

Is this a theme thing? A preprocess thing? I'm sure that once I'm pointed in the right direction I could figure it out but I've looked all over and I'm stuck.

See the attached screenshot. This is a testing order with fake info on my dev site. All I want to do is add the e-mail address associated with the order to that list of info, so that my staff and I can contact the client more efficiently if necessary.

Comments

TynanFox created an issue. See original summary.

umeshsapariya’s picture

We will work on this issue in Drupal code sprint #16

TynanFox’s picture

Excellent, thanks! :)

shylajaphp’s picture

Assigned: Unassigned » shylajaphp

Hi,
I am working on this issue,DrupalMumbaiCodeSprint16

shylajaphp’s picture

StatusFileSize
new642 bytes

Hi TynanFox,
Please review the attached patch and let me know

shylajaphp’s picture

Assigned: shylajaphp » Unassigned
Status: Active » Needs review
shylajaphp’s picture

Hi TynanFox,
Please apply the attached patch and let me know

rszrama’s picture

Version: 7.x-1.13 » 7.x-1.x-dev
Category: Support request » Feature request
Status: Needs review » Active

This is not a good solution, as it's just randomly dropping the e-mail address on a custom profile field rendering. It really should be its own extra field with its own positioning / markup.

shylajaphp’s picture

Hi rszrama,
Thank you very much for your review. i will implement your comment.

shylajaphp’s picture

Assigned: Unassigned » shylajaphp
TynanFox’s picture

Thank you all for working on this!
I'll be happy to review the reworked patch

shylajaphp’s picture

StatusFileSize
new2.92 KB

Hi rszrama / TynanFox,
Kindly review the attached patch. Waiting for your response.

shylajaphp’s picture

shylajaphp’s picture

StatusFileSize
new2.9 KB
shylajaphp’s picture

Assigned: shylajaphp » Unassigned
Status: Active » Needs review
shylajaphp’s picture

Hi rszrama / TynanFox,
Please review the attached patch. Waiting for your response.

rszrama’s picture

Status: Needs review » Active

Sorry, this is not what I meant when I said "extra field." That's an actual Drupal 7 concept for entity properties that can be repositioned / hidden through the field display configuration form. Please see the following docs:

https://api.drupal.org/api/drupal/modules%21field%21field.api.php/functi....

shylajaphp’s picture

Assigned: Unassigned » shylajaphp

Hi rszrama,
Thank you for your review. I will do it.

shylajaphp’s picture

StatusFileSize
new1.8 KB

Hi rszrama / TynanFox,
Please review the attached patch. Waiting for your response.

shylajaphp’s picture

Assigned: shylajaphp » Unassigned
Status: Active » Needs review
sonoutlaw’s picture

Patch works great.

jeetendrakumar’s picture

Status: Needs review » Needs work

@shylajaphp, the patch is not following Drupal coding standards.
Your patch is having more than 2 spaces etc. More info..

Kindly update the patch.

aryashreep’s picture

@shylajaphp, thanks for picking this up. Can you also provide an iterdiff? This greatly helps to review the changes you made without re-evaluating the whole patch.

See: https://www.drupal.org/documentation/git/interdiff

aryashreep’s picture

Assigned: Unassigned » aryashreep
aryashreep’s picture

Assigned: aryashreep » Unassigned
Status: Needs work » Needs review
Issue tags: +#SprintWeekend2018
StatusFileSize
new1.19 KB
new1.19 KB

Updated the patch as per comment #22 with Drupal coding standard and added a new line at the bottom.

Drupal Global Sprint Weekend 2018

[ Asia ]

    [ India ]

    1. [ Bangalore ] - [ January 28 ] - Details

Status: Needs review » Needs work

The last submitted patch, 25: 2846893-25.patch, failed testing. View results

aryashreep’s picture

Status: Needs work » Needs review
StatusFileSize
new1.9 KB
new1.75 KB

Updated the patch.

Drupal Global Sprint Weekend 2018

[ Asia ]

    [ India ]

    1. [ Bangalore ] - [ January 28 ] - Details
lizzjoy’s picture

Issue tags: -#SprintWeekend2018 +SprintWeekend2018

Updated issue tag (removed #)

TynanFox’s picture

Wow - that really looks great, thanks! It's exactly what I needed!

aryashreep’s picture

Hi TynanFox,

Can you please review the #27 and move to RTBC.

Thank you.

TynanFox’s picture

Status: Needs review » Reviewed & tested by the community

Works great, thanks!

rszrama’s picture

Title: How to display the order e-mail address on the order view? » Add an extra field to orders for rendering its email address
Status: Reviewed & tested by the community » Active
Issue tags: -Novice, -DrupalMumbaiCodeSprint16, -SprintWeekend2018

The attached patch heads in the right direction using an extra field, but it should just be named 'order_mail' with a label of 'Order email address.' The description doesn't need to say it's a field ... can just be 'The email address entered for this order during checkout.'

We also need to reproduce the same "hack" here that we used in the product reference module to hide the order email address field from entity views until it's explicitly enabled. It would be odd for it to suddenly show up unannounced. : )

Finally, the hook_entity_view() implementation should be fixed up a bit. The docblock has an extra underscore and it should really be referencing a theme function - ideally with a coordinating .tpl.php file, so the field output can be easily overridden in the theme layer. In this patch, if you don't like the output, you have to work extra to override this implementation.

danmer’s picture

Status: Active » Needs review
StatusFileSize
new4.41 KB

Hello, I have improved the patch from #27 according to #32.

danmer’s picture

StatusFileSize
new4.54 KB
new1.11 KB

Here is a small improvement for the patch.

khiminrm’s picture

Tested patch from #34 with latest dev version of the commerce module on existing site. It works. Display settings of an order view mode should be saved after applying the patch to show email field on an order view page.

rszrama’s picture

Status: Needs review » Fixed

I like the way this came together with regard to ensuring it doesn't just randomly appear on existing sites after the upgrade. The only weird thing about it is that the display settings form shows the extra field as "Visible" even if it hasn't been saved yet, but we'll just have to document the inconsistency. I'm going to add an update function that just exists to show an informational message in that regard.

I also changed my mind re: the labels given these should match what the customer sees on checkout. I updated it to use "E-mail address".

Finally, while e-mail address validation ought to remove any malicious characters, I still think it best to filter the user input through check_plain() when passing it to the theme function.

Thanks again! Committing now.

  • rszrama committed b5ea018 on 7.x-1.x authored by danmer
    Issue #2846893 by shylajaphp, aryashreep, danmer, TynanFox, rszrama,...

Status: Fixed » Closed (fixed)

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