Tags/topics: 
2
Answers
Vote up!
0
Vote down!

How can you edit information displayed on the My account page?

There are billing information and shipping information I wish to get rid of and I dont know how.
Since my drupal commerce instance is on an intranet with ldap auth, i wish also to display the full name of the customer instead of his username.

Asked by: girishmungra
on June 4, 2013

2 Answers

Vote up!
0
Vote down!

Billing and shipping information is not generally displayed on the user account page. It sounds like you're using Commerce Kickstart, which I believe uses the Commerce Addressbook module and perhaps some custom theme template to get that information to appear there. You might simply try disabling the Commerce Addressbook module if you don't need it at all.

Replacing the customer name with the username can be done at the theme level as well, I believe by overriding theme_username(). However, looking up the customer name from a related billing address is an extra query that you probably don't want running on ever pageload. I'd probably add a field to the user account directly to store the full name and copy the information over after the customer completes a checkout. If the name is a field on the user account, you can probably find a module that will then let you use that field value as the title of the user account page.

Ryan Szrama
Answer by: Ryan Szrama
Posted: Jun 4, 2013
Vote up!
0
Vote down!

To remove the billing and shipping data you can add a template preprocess function to your theme. https://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/t...

Simply unset the field you don't like like so:

function YOURTHEMENAME_preprocess_user_profile(&$variables) {
  $account = $variables['elements']['#account'];

  // Helpful $user_profile variable for templates.
  foreach (element_children($variables['elements']) as $key) {
  unset($variables['elements']['information']['shipping_profile']);
  unset($variables['elements']['information']['billing_profile']);
  unset($variables['elements']['recent_orders']);
    $variables['user_profile'][$key] = $variables['elements'][$key];
  }

  // Preprocess fields.
  field_attach_preprocess('user', $account, $variables['elements'], $variables);

If you use panels, you can easily replace the user name with full name.

Answer by: ahimsauzi
Posted: May 12, 2014