[Closed] Search selection list is displaying some items twice and out of order.

This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Related documentation: WordPress custom search with Toolset

This topic contains 8 replies, has 2 voices, and was last updated by  Christian Cox 4 months, 1 week ago. The support staff assigned to this topic is Christian Cox.

Viewing 9 posts - 1 through 9 (of 9 total)
Author
Posts
#519843

I have a custom search set up with a select item as 1 of the filters. It displays a list of a field. Some of the items are listed twice and also out of Alpha order. Here is a link to the page with the view: https://med.virginia.edu/perceptual-studies/publications/academic-publications/

Can anyone help with why this is happening.

#519858

Christian Cox
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/New_York (GMT-04:00)

Hi, I'll be glad to take a look. First, can you try these quick troubleshooting steps?

- Please ensure your WordPress, Toolset plugins, and Theme are all up-to-date. Make a backup of your site before any updates.
- Temporarily disable any non-Toolset plugins, and activate a default theme like Twenty Seventeen. Is the problem resolved?
- Please share a screenshot of any Query Filter settings for this View, as well as a screenshot of your Filter Controls.

#519938

All WordPress and Toolset plugins are up to date. Unfortunately, I am not able to change the theme to test or disable other plug ins at this time.

I have attached a screen shot of the Filter editor window for this view.

#519946

Christian Cox
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/New_York (GMT-04:00)

Okay I understand that it's not always practical to make changes to a live site. Instead, I would like to create a clone of your site so I can investigate further without causing any problems. In order to do this, I would like to install the Duplicator plugin: https://wordpress.org/plugins/duplicator/

If that's okay with you, please provide login credentials to your site here in the private reply fields enabled with your next reply. I will create the site clone, then install it on my local environment to run additional tests. I will remove the plugin and the clone it creates from your site when I'm done.

Please let me know if you approve, and I will proceed. Thanks!

#523136

Christian Cox
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/New_York (GMT-04:00)

Okay let's try a few other things if you cannot provide a clone or access.
- Look in your custom field settings for the 2author-names field. Do any duplicates appear in the options list here?
- Count the number of options available for your field. How does this number compare to the number of options shown in the select box? Are any options missing?
- How is the 2author-names field set up - is this a multiselect, or multiple checkboxes, or a repeating field? Please share any details you can about this field.
- Do you have access to your site's theme files? If so, can you find any custom code that may be modifying these options using the Types API or WordPress API?

#523159

Answers bellow questions

- Look in your custom field settings for the 2author-names field. Do any duplicates appear in the options list here?

No there are no duplicates. I have attached a screen grab of the post fields for this post type.

- Count the number of options available for your field. How does this number compare to the number of options shown in the select box? Are any options missing?

The same. Attached is a screen grab of the fields list in one of the pages for this post type.

- How is the 2author-names field set up - is this a multiselect, or multiple checkboxes, or a repeating field? Please share any details you can about this field.

Multiple line with Allow Multiple Instances checked. Attached is a screen grab of the settings for this field

- Do you have access to your site's theme files? If so, can you find any custom code that may be modifying these options using the Types API or WordPress API?

The Types and WordPress API's have not been altered.

#523173

Christian Cox
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/New_York (GMT-04:00)

Ok thanks, I understand now. The multiple-instance, multiple-line input is at the root of this problem. This input type isn't designed to prevent duplicate entries. Let's say two publications are authored by John Doe. If multiple separate publications include 2author_name "Doe, John", then "Doe, John" will appear multiple times in your list. That's because each item that gets entered here is stored separately in the database, and there is no validation to prevent duplicates. Therefore no two publications can ever have the same author. Their authors only have the same name, if that makes sense.

To make this work as you expect it to work, you must use a different input type. You could use a checkbox group or a multiselect, but either way the options must be predefined.

Another approach would be to use a custom author taxonomy. Then you can use the taxonomy interface to manage authors for each publication. This interface includes a typeahead combined with the ability to add new authors easily, so you wouldn't have these duplicate results.

Let me know if I can provide additional assistance here.

#525271

Thank you, I understand your suggestions.

I am wondering why this is a seemingly intermittent issue ? For instance, there are many articles authored by Bruce Greyson and his name only appears once in the list -- where as Jim Tucker has authored not as many and his name appears more than once ?

Also, I was wondering if there is any way to sort a check box field by last name -- so if I set up a post field as multiple check boxes with an author name listed as Bruce Greyson, another as Ian Stevenson, etc... can those be sorted by last name automatically ?

#525333

Christian Cox
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/New_York (GMT-04:00)

Hmmm, I must admit that I misunderstood how repeating multiline fields work with search. After some additional tests on my end, I can see that duplicates aren't created when you add authors with the same name. Instead, the only way I can create duplicates in my list is if the author name includes a carriage return after the text. So even though the names are spelled the same, the spacing and line breaks are different. In this case, these two entries will appear as duplicates. So apologies if I misled you there, I stand corrected. The easiest fix would be to go through all the posts and ensure there are no extra carriage returns after the author's name.

To answer your other question, if you do decide to go with checkboxes, you can reorder the options by drag and drop within the custom field editor.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘[Closed] Search selection list is displaying some items twice and out of order.’ is closed to new replies.

Known issues and their solutions

We document known issues and their solutions in Toolset erratas. Save time by checking there first and seeing if what you are facing is a known issue. This list is kept short. We do our best to resolve all known issues with every release of Toolset plugins.

Support Policy

Toolset staff will help you use the Toolset plugins correctly, provide any information you need, help troubleshoot problems and advice on best-practices.

Please make sure to issue only one topic per each support ticket.

For more information, read our full Customer Support Policy.

Need custom programming work for your site? Check out our certified partners.