Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi ,
I am alter the views query with this
function cc_invoice_views_query_alter(&$view, &$query) {
foreach ( $query->where[0]['clauses'] as $key => $value) {
$explode = explode('.',$value);
if($explode[1] == "field_status_value = '%s'") {
$alias = $explode[0];
if($query->where[0]['args'][$key] == '0') {
$query->where[0]['clauses'][$key] = $alias . ".field_status_value IN ('%s' ,'%s')";
#$query->where[0]['clauses'][$count] = $alias . ".field_status_value IN '%s'";
$query->where[0]['args'][] = -2;
}
elseif ($query->where[0]['args'][$key] == '1') {
$query->where[0]['clauses'][$key] = $alias . ".field_status_value IN ('%s' ,'%s')";
$query->where[0]['args'][] = 8;
}
break;
}
}
}
In this code, I just altered the views query. the result is displaying rightly, but in the views calculation section, the subtotal and total is not rendering right. It does not add the altered value while calculating the total or sub-total. Is there anything else i need to correct here. Please advise.
Comment | File | Size | Author |
---|---|---|---|
views_calc.png | 36.62 KB | j.lucky |
Comments
Comment #0.0
j.lucky CreditAttribution: j.lucky commentedBetter format
Comment #1
j.lucky CreditAttribution: j.lucky commentedComment #1.0
j.lucky CreditAttribution: j.lucky commentedText change
Comment #2
KarenS CreditAttribution: KarenS commentedThe D6 version is no longer supported.