Skip Navigation

[Escalated to 2nd Tier] parametric search conditional location stopping results with no location

This support ticket is created 5 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 8 replies, has 2 voices.

Last updated by Nigel 5 years ago.

Assisted by: Nigel.

Author
Posts
#1400363

I am trying to:
Use Parametric Search to show CPT with custom fields. Location field is conditional and only used on some CPT.
Distance Location is used in the search and will show correct results.
However, even when this is not selected with a value, all CPT with no distance data is ignored in the results.

We have CPT "Listings"
This has an option of Course Type with the options for "Location" or "Online"
Location gives the option of "Dates", "Location", "Day Of Week"
This data is only available when Location is selected.

The Parametric Search Filter - Query Filter - Distance is enabled, means results with no location data is ignored.

Link to a page where the issue can be seen:
hidden link

I expected to see:
Online and Location results when CPT Custom Field is selected correctly

Instead, I got:
The Parametric Filter removed CPT of items with no location data, even though the location filter hasn't and data selected to be filtered

#1400639

Nigel
Supporter

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

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

Hi Stephen

Are you ordering results by location?

The way that WordPress queries work (because of how the underlying MySQL works) is that if you order by some field, and posts which don't have a value for that field will be excluded from the results.

If that's the case, there is no fix or workaround because that's how WordPress works.

You would need to order by some other field.

#1400665
Screenshot 2019-12-05 12.25.09.png

Hi,

No, they are ordered by post date,
If I put in some dummy data to the field it will show,
It seems like its skipping the post as the field is blank/non-existant.

I could possibly set CRED to default a hidden value, but don't think this is the correct approach to the problem.

Stephen

#1400719

Nigel
Supporter

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

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

OK, thanks for clarifying.

Can you also confirm, do you see all the results on the initial page load, and it is only when applying some filter (some other filter, not the distance search) when the posts with no location are omitted?

If that's the case it sounds like a default distance is being applied even when none is selected, and if that's the case I can test that, but would like confirmation first.

#1400767

Hi,

The form is only shown on the front-page

If you visit the results page directly they are still hidden with no filters selected.

hidden link

The single online course I filled with dummy location data shows,

I can't find any reason for the filter to be applied when not selected.

Stephen

#1400871

Nigel
Supporter

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

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

OK, well let me test a similar set up locally, and if I can't reproduce the problem I'll ask for a copy of your site.

#1401447

Nigel
Supporter

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

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

Actually, this is pretty easy to reproduce, I'm surprised it hasn't come up earlier.

I've escalated this so that my colleagues can investigate further, and I'll let you know as soon as I have some feedback from them.

#1411717

Hi,

Is there any update on this?

Stephen

#1411727

Nigel
Supporter

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

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

Sorry, I don't have any news other than that it will be fixed in the next version of Maps, but I don't have a timescale for when work on that will be finished I'm afraid.

I added a comment to the internal ticket indicating that you are asking about progress.