sum columns in the row

admin_wiky 16 Jul, 2014
1 Likes
Hi all,

How i can sum some fields in the row to the special column in CCv4?
marcinwolejko 16 Jul, 2014
Answer
1 Likes
HI.
I've done some calculations in CCv4 but not in the column. The calculations are made in a table right under the mail listing.
I've got a column with k1 value.
In the header I've got
<?php
global $total_k1;
$total_k1 = 0;
?>
<?php
global $total_total;
$total_total = 0;
?>


In the body section:
<?php
global $total_k1;
$total_k1 += $row['k1'];
?>


And the footer section:
An excerpt from the table:
<td>

Sum of K1: <input id="razemk1" type="text" size="12" maxlength="12" name="razemk1" value="<?php global $total_k1;
echo "$total_k1";
?>">
</td>
admin_wiky 16 Jul, 2014
thx, but isnt my case :]
marcinwolejko 16 Jul, 2014
No problem homeopat.
I thought that this could be useful (at least the code)😉
admin_wiky 16 Jul, 2014
I use autolisting in CC so I need add one column where will by sum of columns in every row.
admin_wiky 22 Jul, 2014
Can anybody help me?
I tried put some code in custome code (CCv4) and it doesnt work with
$form->data['column_name'];

or
$row['column_name']

it doesnt show data from db.
admin_wiky 20 Aug, 2014
U had right.
in php functions:

model.column: $sum=$row['model']['column']+$row['model']['column']; return $sum;
This topic is locked and no more replies can be posted.