On a content template I have created a view which I include by shortcode, which shows the number of reviews, where reviews are a CPT with a child relationship to the current product CTP. This part works fine.
I then a view on the page which displays similar products. Posts of the same CPT. In the loop item of that view, I the "reviews count" view is included. In this instance, it breaks and does not show the correct value or output.
Hi,
To troubleshoot this, I'll need to see how this view and the reviews are set up in the admin area.
Can you please share temporary admin login details, along with the link to an example page where the incorrect number of reviews can be seen?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Thank you for sharing the access details, but I'm getting the incorrect 'username' message.
Can you please check the username and password again?
Note: I've set your next reply as private.
Thank you for sharing the admin access details.
I understand that the website is using the view named "Product: Reviews (count)" to show the count of related review posts, in the "Template for Products", twice.
Once for the current product and the other instance is inside the loop of the view "Product: Related products".
I've changed the "Product: Reviews (count)" view's query filter settings to "The post with ID set by the shortcode attribute: wpvrelatedto", so that it is not dependent on the current post or the post from the current view's loop, as we need to make it work for both these instances.
Through this change, we'll be able to pass the current post's ID using the "[wpv-post-id]" shortcode into the shortcode attribute "wpvrelatedto" and the view will use that as a reference to get the related posts:
[wpv-view name="product-reviews-count" wpvrelatedto="[wpv-post-id]"]
I've made this change to both the shortcodes of this view in the template as well, but there is a separate challenge involved. No matter what change is made to the "Product: Related products" view it is for some reason not getting updated on the front end.
( I've tried disabling the view's cache and clearing the SiteGround Cache too )
Do you recall adding any custom code on the website, to change the output of the view "Product: Related products" or any other view for that matter?
Please also ensure all involved caches have been cleared and if the issue persists, I'll need your permission to download a clone/snapshot of the website.
Hi. There is no custom code on the website whatsoever, and I have tried deleting and refreshing all caching but with no success.
you have my full permission to set up a snapshot of the site.
I apologize for the delay in getting back on this, as we had an unusually busy forum queue last week.
I've downloaded the website's clone and will be performing some tests on it. Will share the findings, as soon as this testing completes.
Thank you for your patience.
Thank you for waiting.
During troubleshooting, I noticed that the following two views that were being used inside the template "Template for Products" were not saved properly and hence any changes that were being made to them were not getting updated on the front end.
1. Product: Related products
2. Product: Product reviews
I deleted them and recreated the new ones and they started working as expected.
You can follow the same on your live website too and then use the view's shortcode with the attribute, as suggested in my earlier message.
( ref: https://toolset.com/forums/topic/view-with-items-found-count-displaying-incorrect-values/#post-2487809 )