Skip Navigation

[Resolved] Double items displayed in view with related items

This support ticket is created 3 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by Nigel 3 years ago.

Assisted by: Nigel.

Author
Posts
#2275061

I have a view that displays related custom posts for the given product.
The problem is that some of the displayed customs posts are being displayed mutliple times.

You can see here the sample - hidden link
Below you will find double displayed i.e.:
- Projekt pokoju dla dziewczynki, Jagody (4 lata) (#492)
- Projekt pokoju dla dziewczynki, Wiktorii (1 rok) (#686)
etc

I have double checked the relation in my Products and the related custom posts are connected properly - only one time.
I have also disabled Litespeed cache plugin - nothing helps.

#2275203

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2022-01-25 at 14.28.46.png

Hi there

I checked the front end and can see that there are several duplicates shown (for reference, the screenshot shows the IDs).

To be able to see what's going on I'll need access to the back end, and possibly to take a copy of the database for testing.

I tried to log in with the credentials you provided, but they don't work.

Let me set another private reply so you can update them.

#2276041

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The View that displays the related posts uses pagination (infinite scrolling) with random sorting order.

These will lead to unpredictable results. When the second page of results is retrieved and random ordering is used then *any* results can be included in the new page of results, including ones that have been previously shown. Because the View is set to use infinite scrolling (so that new pages of results are appended to the existing results rather than replacing them) you can see the same posts appearing multiple times.

#2276045

Ok, thank you for the detailed explanation.
For me it sounds like a bug in toolset implementation. I'm seeing first time that such combination of infinite scrolling and random order producing this weird results. Any plans to fix it?
What do you propose as a workaround for it? I want to keep the random order of related results.

#2276047

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

It's certainly not a bug, it is a logical conclusion of using random ordering with pagination.

It could only work differently if the pagination were "fake" pagination, where, instead of querying a sub-set of results from the database for each paged update, the entire set of results were shipped to the browser, which then selectively showed some results while hiding others.

It could be done, but would be an awful solution on sites where there were many results to paginate.

A custom app might implement things differently, but Toolset is built for WordPress, and this is an inevitable result of how pagination works in WordPress.