Range slider does't work with array + quotation marks problem

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Range slider does't work with array + quotation marks problem

This topic contains 2 replies, has 2 voices, and was last updated by Federico Federico 7 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #11375

    Hello and, first of all, happy holidays!

    I have been using ASP and ACF Pro together for a while and they work like a charm, but I stumbled upon two little problems which I hope can be solved.

    1) I was using a Range slider with a “number” field to filter custom posts by year interval, and it worked beautifully. Then I noticed I need to associate post types to multiple years (es: 1978, 1980… etc.) and I changed the “number” field to other fields which allow multiple selection, but I couldn’t manage to make it work, probably because the output becomes an array.
    I can use a selector field in ASP instead of a range slider, but this way I lose the possibility to select a range.
    I tried to use different field types in ACF Pro (checkbox, select, repeater), but to no avail: ASP doesn’t show results. If I use a repeater I can select in ASP only one subfield (and not multiple field like in the “sources” section), and it defeats the purpose.
    Is it possible to do something to make it work? I can use any ACF Pro field, as long as it allows multiple selection.

    With select/checkbox/radio button ACF Pro field type the structure of the array is like this, even though the value is probably a string:
    array ( 0 => ‘1978’, 1 => ‘1980’, )

    With a number repeater, it’s like this:
    array ( 0 => array ( ‘anno_anni_lemma’ => ‘1980’, ), 1 => array ( ‘anno_anni_lemma’ => ‘1978’, ), )

    2) I noticed there is some problem with curly quotation marks (‘, ’, “, ”). Since with accented vowels there is no problem, I thought it would be the same with quotation marks, but the behaviour is like this:

    Primary keyword logic: OR
    Show exact matches only?: OFF

    Search string: Vigata Actual post type title: Vigàta Behaviour: FOUND
    Search string: Bell’Antonio (straight) Actual post type title: Bell’Antonio (curly) Behaviour: NOT FOUND
    Search string: Bell Antonio Actual post type title: Bell’Antonio (curly) Behaviour: FOUND

    I tried to add curled quotation marks in the keyword exception list to “null” them, but it doesn’t work.
    Oddly enough, in the second example, even though there are no results, the post type shows in the “Did you mean” list.
    I can obviously change all curly quotation marks in straight quotation marks, but there is always the risk that someone loads new posts with curly quotation marks.

    Thank you in advance for what you can do.


    Federico Diana

    • This topic was modified 7 years, 3 months ago by Federico Federico.
    • This topic was modified 7 years, 3 months ago by Federico Federico.
    • This topic was modified 7 years, 3 months ago by Federico Federico.
    Ernest Marcinko
    Ernest Marcinko

    Hi Federico,

    1. In short: it’s not possible, and there is no workaround either yet, and I don’t think there will be soon.

    The main strength of the plugin is to do these kinds of operations on the database level, and since multi-select (and other more complex fields) are stored as serialized variables (or references) in the database – it’s no longer a single numeric value, it’s treated as a string on database level. So the query basically compares the inputted value to the stored value, which is in this case a string of the serialized arrays.

    2. Yes, unfortunately the quotation marks are not treated as accented characters, they are all different from one another. The best possible solution in this case is to simply remove all kinds of quotation marks from the input before the search process, with a custom function.

    There is a knowledge base article available on replacing characters in the search phrase here: https://goo.gl/oMdmun
    Just replace the $characters variable (line 8) with something like this:

    $characters = "‘’“”'\"";

    This will clean the search phrase from the quotation marks (and any other character you might specify).

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    I guess a dropdown with multiselect will settle it. The replacement works perfectly.
    Thank you!

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

You must be logged in to reply to this topic.