Hi there,
I am doing some calculations with custom fields as described here:
https://toolset.com/forums/topic/make-additon-with-toolset/
with [add-to-total] and [show-total] wich works fine as you can see in this example:
hidden link
The table at the top (Gesamtstrecke, Tagesetappen, etc.) are just sums of custom fields of the custom post types below. To get this working I used a paged where I put some views together:
<div class="table-1">
<table width="100%">
<thead>
<tr>
<th style="text-align: center;" align="left">Gesamtstrecke</th>
<th style="text-align: center;" align="left">Reifenpannen</th>
<th style="text-align: center;" align="left">Anzahl der Tagesetappen</th>
<th style="text-align: center;" align="left">[fusion_tooltip title="Berechnungsgrundlage / Basis: 23,8g pro Liter Benzin / 100km | Fallbeispiel: PKW verbraucht 8 Liter Benzin auf 100km" class="" id="" placement="top" trigger="hover"]CO2-Ersparnis[/fusion_tooltip]</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;" align="left">{!{wpv-view name='gesamtkilometer' cached='off'}!}</td>
<td style="text-align: center;" align="left">{!{wpv-view name='gesamtpannen' cached='off'}!}</td>
<td style="text-align: center;" align="left">{!{wpv-view name='gesamtetappen' cached='off'}!}</td>
<td style="text-align: center;" align="left">{!{wpv-view name='gesamtco2' cached='off'}!}</td>
</tr>
</tbody>
</table>
</div>
My question:
This works perfectly fine as long as I don't use any custom filters. Can you show me a way to apply the filters I applied to the grid in the main loop also to all the views I am using to calculate the sums?
In other words: If I filter some entries, the sums should also only calculated with the filtered entries.
Thank you very much in advance.
Theo
Hi Theo,
Thank you for contacting us and I'd be happy to assist.
I checked the page, but couldn't see any filter for the custom fields. Can you please share temporary admin login details, so that I can see how this is set up in the admin area? Also, include the details of how and when it is working and when it is not.
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing the admin access.
I noticed that two views were used on the page to show the total counter using the "[show-total]" shortcode:
- PL Grid
- Gesamtgewicht
But, because the search filters were only included in the view "PL Grid", when the search filter was used, the filtering of posts would only occur in this view, but, not in the "Gesamtgewicht" view.
I've added the taxonomy query filters in the "Gesamtgewicht" view so that it is linked to the same URL parameter used by the search fields of the view "PL Grid" and now the search filters are applied to both the views.
( screenshot: hidden link )
Result screenshot:
hidden link
My issue is resolved now. Thank you very much!