Skip Navigation

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

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.
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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

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

This topic contains 8 replies, has 2 voices.

Last updated by Christian Cox 7 years, 6 months ago.

Assisted by: Christian Cox.

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: hidden link

Can anyone help with why this is happening.

#519858

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
DOPS_FilterEditor_screenshot.jpeg

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

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

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
DOPS_Post Flields list.jpeg
DOPS_Fields in PostType Editor.jpeg
DOPS_Field Settings.jpeg

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

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

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.

The forum ‘Types Community Support’ is closed to new topics and replies.