I have a code like this:

function price_views_query_alter(&$view, &$query) {
  if ($view->name == 'view_name') {
    $query->add_field(
      NULL,
      'MY_FUNCTION(table_name.field_name)',
      'field_name_alias'
    );
  }
}

How to get value of this newly added field in views theme file (views-view-table--view_name.tpl.php)?

Thank you for your attention.

Comments

dawehner’s picture

Status: Active » Fixed

See this easy example code

foreach ($view->result as $row) {
  print $row->field_name_alias;
}

I think this makes it clear how to get it.

Status: Fixed » Closed (fixed)

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