Forums Forums Search & Filter Pro Having Troubles Working with Advanced Custom Fields Selects

Viewing 9 posts - 1 through 9 (of 9 total)
  • Anonymous
    #50960

    Hello,

    I just purchased and installed Search & Filter Pro, but are running into a few issues.

    So first, I’ll give you a little background info.

    I have a custom post type named, Products. As far as the CPT options, I have public and public_query set to true, exludes_from_search set to false. Now I do have has_archive set to false, because I do NOT want an archive page.

    I’m also using Advanced Custom Fields Pro. I have a field group set up to use on the Products CPT.

    So now brings me to the Search and Filter part.

    In the search form I need 4 dropdowns. 2 of these I need to populate with the select options as one of the ACF fields that is in the Products CTP. For example, I have ACF select field for Product Category (Category 1, Category 2 and Category 3). Only one will be selected when creating a new product. So I need the first drop down in the SAF form to populate with the same options as the ACF Select Field.

    The last 2 dropdowns in my SAF Pro form, need to populate with the values entered in a text ACF Field. For example, I have a ACF field called Product Number. So in my SAF Pro form, I need the dropdown to populate with all Product Numbers (one from each products).

    Here is what I have done as far as creating the form. If I didn’t specify an option I picked it was because I left it at the default value.

    °Selected only “products” from “search in the following post types”
    °Results per page – set to -1. I need all posts returned
    °Left “AND” in field relationship
    °Used 4 Post Meta Fields (Choice) in the Search Form UI – Since each Dropdown is using ACF fields
    °Input type = Dropdown, Meta key = selected the ACF field from dropdown.
    °Checked Is ACF Field checkbox.
    °In the Display Results Tab, I selected “Using a shortcode” from the Display results method. *using do_shortcode() in my page template file
    °In the Display Results Tab, I entered the URL for page the results will be on – which is the same page as the form.
    °After I published the form, I “built the cache”

    So, when I view the page I put the shortcode on, I see the 4 dropdowns I created (even though I wish I could put side-by-side, instead of stacked.

    The bad part is, when I click on each dropdown, all I see are the field keys for the meta key I entered. For example, my first checkbox, Product Category, it is showing field_57431f6616cc2 (0) in the dropdown. This is the field key for the Meta Key I entered when creating the S&F form. I need it to populate with the 3 options (category 1, category 2 and category 3). Same thing with the other dropdowns. It’s just showing the field keys with a 0 count, when it should be returning the value entered for each Products CPT.

    Any better explanation on what I might be doing wrong, or how to do correctly would be greatly appreciated.

    Trevor
    #51008

    The display you see is because you have selected the incorrect meta key. With a Field title of Product Number, ACF will give this a slug name (Meta Key name) of product-number (I think), and in the list that you can choose from, you will see _product-number and some way down also product-number.

    You need the second one, without the preceding underscore.

    Anonymous
    #51037

    Hi Trevor,

    Thank you very much, that was it! So now my dropdown’s are populating correctly.

    Unfortunately, a new issue has arisen. Now it is showing 0 for the count and will not return any posts.

    Based off my description in the original message, do you know of any quick things I can do to try and troubleshoot this issue?

    Thanks in advance.

    Ryan

    Trevor
    #51045

    Do you have Auto Count switched on?

    Anonymous
    #51050

    Hi Trevor,

    Thank you for speedy feedback!

    I actually figured out my issue. I’m embarrassed to admit that I had forgot to add the shortcode to display results, I only had the one for the form.

    So the plugin is working great now.

    Now for my last 2 questions, I swear. I appreciate you being patient with me.

    1. Is there a way to customize the results? By that I mean, I want to display ACF values in the results, and get rid of the WP “category” and publish date.

    My goal is to display the results in a row (using Zurb Foundation 6), where each of the 5 values I want to display are in their own column. So would be a row of 5 columns, each with a ACF field value.

    2. Is the results using the themes index.php for the results? or is there a template within the plugin that controls the layout?

    If is using the index.php, is there any way I have it use a custom template?

    Thanks,

    Ryan

    Trevor
    #51056

    You can customize results in 2 ways. Either by using your theme’s own template files, using the As an Archive option and making a copy of the desired template file and editing that, OR you can use the shortcode method and this uses our template file, and you can customize that according to our documentation.

    Anonymous
    #51072

    Thank you very much sir! I really appreciate your help.

    Trevor
    #51074

    Is there anything else you need, or can I close the thread?

    Anonymous
    #51078

    Nope, I’m all set, was able to create my own results template. You can close this thread. Thanks again for you help.

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