1

I have a Civicrm set up in Drupal 7. I am showing Civicrm data using two different views.

In one of the view I have set contextual filter to get the contact IDs. From another view I am passing contact IDs as the contextual argument.

Now the issue is, the filter is not working for those IDs which are in thousand. For e.g. 1,223.

Further, when i used the Views php module to pass php value to remove that comma, it is creating Ajax internal server error.

Below is the code, I used in views php field.

<?php echo str_replace(',', '', $row->contact_id); ?>

I have checked below link, but that is also not working in this case

Thousands separator (comma) in term id

Please suggest a solution which will work without any ajax issue.

1 Answer 1

0
/**
 * Implements hook_views_data_query_alter().
 *
 * @param $view
 *   Information about Views' tables and fields.
 *
 * @param $query
 *   Information about query used in this views.
 */
function my_module_views_query_alter(&$view, &$query) {
  // Only edit your view whose contextual filter need to be edited.
  if ($view->name == 'your_view_name'){

    // Get your contextual filter field and use your code to strip comma.
    // str_replace(',', '', $row->contact_id);
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.