Hello,
I have a Views that display "inscription" posts.
For each post, I have the price paid (numeric field) and the type of inscription (radio field with different potential values : adhesion, sorties, conférences).
So, in my Views, I have a table that display the price paid, but depending of the type of inscription in the specific column (relative of the inscription type).
So, the result is like this :
Inscription Adhésion Sorties Conférences
1 20
2 25
3 10
and so on.
Now, I want to add in the bottom of the table, the sum of each column. I have found this thread (https://toolset.com/forums/topic/sum-quantities-of-the-column/ ) that works fine if we have only one column to sum.
Here, I want to have the sum of each column independently, knowing that the custom field that is displayed is always the same (I'm just using conditional output to display it at the right column).
How can I get this sum in the bottom of each column?
Regards
Pat
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Pat,
Thank you for getting in touch.
I can let you know that this is going to require custom coding which is out of our forum scope.
However if you let me see an example of the table then I can point you in the right direction for this.
Thanks,
Shane
Hi Shane,
Thanks for taking care.
Here is my Views :
Loop editor :
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<table width="100%" class="table-striped table-bordered table-hover table-sm">
<thead>
<tr>
<th>CA</th>
<th>NC</th>
<th>AT</th>
<th>LG</th>
<th>IN</th>
<th>SO</th>
<th>CO</th>
<th>AD</th>
</tr>
</thead>
<tbody class="wpv-loop js-wpv-loop">
<wpv-loop>
<tr>
[wpv-post-body view_template="loop-item-in-backoffice-etat-inscriptions-et-paiements"]
</tr>
</wpv-loop>
</tbody>
</table>
<!-- wpv-loop-end -->
<table width="100%" class="table-striped table-bordered table-hover table-sm">
<thead>
<tr>
<th>CA</th>
<th>NC</th>
<th>AT</th>
<th>LG</th>
<th>IN</th>
<th>SO</th>
<th>CO</th>
<th>AD</th>
</tr>
</thead>
<tbody>
<tr>
<td>[count_numeric_cf field="wpcf-tarif-du-produit-achete" action="sum"]</td>
<td>[count_numeric_cf field="wpcf-tarif-du-produit-achete" action="sum"]</td>
<td>[count_numeric_cf field="wpcf-tarif-du-produit-achete" action="sum"]</td>
<td>[count_numeric_cf field="wpcf-tarif-du-produit-achete" action="sum"]</td>
</tr>
</tbody>
</table>
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
And loop item :
<td style="text-align:right;">[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Ateliers' )"][types field="tarif-du-produit-achete"][/types][count_numeric_cf field="wpcf-tarif-du-produit-achete" action="add"][/wpv-conditional]</td>
<td style="text-align:right;">[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Langues' )"][types field="tarif-du-produit-achete"][/types][count_numeric_cf field="wpcf-tarif-du-produit-achete" action="add"][/wpv-conditional]</td>
<td style="text-align:right;">[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Informatique' )"][types field="tarif-du-produit-achete"][/types][count_numeric_cf field="wpcf-tarif-du-produit-achete" action="add"][/wpv-conditional]</td>
<td style="text-align:right;">[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Sorties' )"][types field="tarif-du-produit-achete"][/types][count_numeric_cf field="wpcf-tarif-du-produit-achete" action="add"][/wpv-conditional]</td>
<td style="text-align:right;">[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Conférences' )"][types field="tarif-du-produit-achete"][/types][count_numeric_cf field="wpcf-tarif-du-produit-achete" action="add"][/wpv-conditional]</td>
<td style="text-align:right;">[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Adhésion' )"][types field="tarif-du-produit-achete"][/types][count_numeric_cf field="wpcf-tarif-du-produit-achete" action="add"][/wpv-conditional]</td>
Regards
Pat
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Pat,
I would suggest taking a look at the link below as this should be able to help you.
hidden link
Thanks,
Shane
Hi Shane,
The link you proposed was answering 100% of my concern.
Many thanks
Pat