Skip to main content
Added link to TPL file and put theme hook suggestions in a list to improve readability
Source Link

For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

commerce_order, commerce_order__commerce_order, commerce_order__commerce_order__customer, commerce_order__OID (where OID is the order ID)

  • commerce_order
  • commerce_order__commerce_order
  • commerce_order__commerce_order__customer
  • commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.

template.php

/**
* Process variables for MYTEMPLATE--order.tpl.php.
*/
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor
  template_preprocess_entity($variables);
}

/**
 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
 */
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';
  }
}

From there you can use: sites/all/modules/entity/entity.tpl.phpsites/all/modules/entity/entity.tpl.php as a template for your template.

Hope this helps someone.

Cheers,

Rob

For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

commerce_order, commerce_order__commerce_order, commerce_order__commerce_order__customer, commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.

template.php

/**
* Process variables for MYTEMPLATE--order.tpl.php.
*/
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor
  template_preprocess_entity($variables);
}

/**
 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
 */
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';
  }
}

From there you can use: sites/all/modules/entity/entity.tpl.php as a template for your template.

Hope this helps someone.

Cheers,

Rob

For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

  • commerce_order
  • commerce_order__commerce_order
  • commerce_order__commerce_order__customer
  • commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.

template.php

/**
* Process variables for MYTEMPLATE--order.tpl.php.
*/
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor
  template_preprocess_entity($variables);
}

/**
 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
 */
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';
  }
}

From there you can use: sites/all/modules/entity/entity.tpl.php as a template for your template.

Hope this helps someone.

Cheers,

Rob

added 20 characters in body
Source Link

For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

commerce_order, commerce_order__commerce_order, commerce_order__commerce_order__customer, commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.

template.php

/**
* Process variables for MYTEMPLATE--order.tpl.php.
*/
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor
  template_preprocess_entity($variables);
}

/**
 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
 */
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';
  }
}

From there you can use: sites/all/modules/entity/entity.tpl.php as a template for your template.

Hope this helps someone.

Cheers,

Rob

For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

commerce_order, commerce_order__commerce_order, commerce_order__commerce_order__customer, commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.

/**
* Process variables for MYTEMPLATE--order.tpl.php.
*/
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor
  template_preprocess_entity($variables);
}

/**
 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
 */
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';
  }
}

Hope this helps someone.

Cheers,

Rob

For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

commerce_order, commerce_order__commerce_order, commerce_order__commerce_order__customer, commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.

template.php

/**
* Process variables for MYTEMPLATE--order.tpl.php.
*/
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor
  template_preprocess_entity($variables);
}

/**
 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
 */
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';
  }
}

From there you can use: sites/all/modules/entity/entity.tpl.php as a template for your template.

Hope this helps someone.

Cheers,

Rob

Source Link

For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

commerce_order, commerce_order__commerce_order, commerce_order__commerce_order__customer, commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.

/**
* Process variables for MYTEMPLATE--order.tpl.php.
*/
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor
  template_preprocess_entity($variables);
}

/**
 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
 */
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';
  }
}

Hope this helps someone.

Cheers,

Rob