Hello,
I have a Views the list all the products (228 currently). Inside this Views, I need to display for each product (in addition with some standard items) the number of users that have bought this product.
Each time a user buys a product, a post is created (ins-enseignement) with the product ID. The user is the author of the post.
Then, I have created another Views that list all users that are author of the ins-enseignement (there is 7k posts for this postype currently).
That works fine, but when I want to display the page which list all products, then I need to wait more than 30 seconds !!!
If I remove the second Views, then the page display in less than 1 second.
I have placed as a screenshot the second Views (Backoffice nb inscits a un cours) and here is the loop of the first one that lists the products :
<td>[wpv-post-id]</td>
<td>[types field="nom-de-l-evenement"][/types]</td>
<td>[types field="type-d-evenement"][/types]</td>
<td>[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Ateliers' ) OR ( $(wpcf-type-d-evenement) eq 'Langues' ) OR ( $(wpcf-type-d-evenement) eq 'Informatique' )"][types field='jour'][/types]</br>[types field='heure'][/types]h[types field='minutes'][/types][/wpv-conditional][wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Conférences' )"][types field='date-evenement' style='text' format='d/m/y'][/types]</br>[types field='date-evenement' style='text' format='G'][/types]h[types field='date-evenement' style='text' format='i'][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Sorties' )"][types field='date-evenement' style='text' format='d/m/y'][/types][/wpv-conditional]</td>
<td>[wpv-post-title item="@formateur-product.parent"] [types field='prenom-formateur' item='@formateur-product.parent'][/types]</td>
<td>[wpv-post-title item="@localisation-product.parent"]</td>
<td>[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Ateliers' ) OR ( $(wpcf-type-d-evenement) eq 'Langues' ) OR ( $(wpcf-type-d-evenement) eq 'Informatique' )"][types field='jour'][/types]</br>[types field='heure'][/types]h[types field='minutes'][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Conférences' )"][types field='date-evenement' style='text' format='d/m/y'][/types]</br>[types field='date-evenement' style='text' format='G'][/types]h[types field='date-evenement' style='text' format='i'][/types][/wpv-conditional]
[wpv-conditional if="( $(wpcf-type-d-evenement) eq 'Sorties' )"][types field='date-evenement' style='text' format='d/m/y'][/types][/wpv-conditional]
</td>
<td style="text-align:right;">[wpv-woo-product-price]</td>
<td>[types field="date-prevente" format="d/m/Y"][/types]</td>
<td style="text-align:right;">[wpv-post-field name='_stock']</td>
<td style="text-align:right;">[wpv-view name="backoffice-nb-inscits-a-un-cours" anneeuniv="[annee_univers]" idprod="[wpv-post-id]" ]</td>
<td style="text-align:right;">[wpv-view name="backoffice-nb-attente-a-un-cours" anneeuniv="[annee_univers]" idprod="[wpv-post-id]"]</td>
<td>[wpv-conditional if="( $(wpcf-annule) eq '1' )"]Oui[/wpv-conditional][wpv-conditional if="( $(wpcf-annule) eq '0' )"]Non[/wpv-conditional]</td>
<td>[types field='desactivation-dela-fiche' state="checked"]Non[/types][types field='desactivation-dela-fiche' state="unchecked"]Oui[/types]</td>
<td>[toolset-edit-post-link content_template_slug='backoffice-modification-fiche' class="new-tab-link" target='self']Modif[/toolset-edit-post-link]</td>
<td><a href="[wpv-post-url]" target="_blank">Voir</a></td>
<td style="min-width:5%;">[cred_delete_post_link action='trash' text='<span style="color:red;font-weight:bold;">X</span>' message_after='La suppression a bien eu lieu' message='Etes-vous sûr de vouloir supprimer cette fiche?' message_show='1' class='cred-refresh-after-delete']</td>
<td><a href="<em><u>hidden link</u></em>" class="et_pb_button" target="_blank" rel="noopener">ADMIN</td>
Let me know if there is another way to manage this?
Regards
Pat