• Resolved quackounousa

    (@quackounousa)


    Hi There,

    I’m trying to load all the custom fields into one dropdown. I’ve had some success in the code (Shortcodes.Php- Left Checkbox on Desktop and Dropdown on Mobile, use a Mobile device to test) but I just can’t find a way to place all of them into one. I basically need “Complexion”, “Lips” and “Eyes” to be in one dropdown instead of three.

    Also, how can I NOT display Values that have “0” as count? I found the AJAX function but that didn’t do anything when modifying it.

    If one of the developers could help me on that I would appreciate it.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello quackounousa,

    I think the approach that you are following might not be the best approach to do what you want to do. Could you explain from the beginning with what you want to achieve here? You have put categories in a dropdown Lips, Complexion, Eyes. Do you only have these three categories? Do you have any subcategories? All the others seem to be Custom fields in the sidebar. Could you please explain, how you want to structure your items?

    Do you mean that you don’t want to display custom fields if they are empty? Having no products?
    This is a premium feature and can be used by setting “Hide Blank Custom Fields” to ‘Yes’ in the Premium section under the Options Tab in the plugin dashboard.

    Thread Starter quackounousa

    (@quackounousa)

    Categories are Makeup and Skincare
    Sub-Categories are Eyes, Lips & Complexion
    Sub-Categories 2 are Blush, Primer created as a Custom Field.

    I want to have three dropdowns:
    1- Dropdown one has “Eyes, Lips & Complexion”
    2- Dropdown 2 fills itself with the Custom Fields Value where the Custom Field Name == SubCategory Name so they know who is who.
    3- Dropdown 3 only shows the Brands where the above criteria return a number of products >0

    Thanks

    Thread Starter quackounousa

    (@quackounousa)

    Alright I have managed to add all the Custom Fields I want into one Dropdown.

    I’m now looking to where I can modify the code that comes after a filtering is done. Can you point me to the function that controls the display of Custom Fields after a search has been completed?

    Thanks

    • This reply was modified 6 years, 10 months ago by quackounousa.

    Hello quackounousa,

    You should be able to achieve this without updating the code for the plugin. If you create only two categories and add individual products in those categories. Then create three custom fields:
    1) Custom Field 1 with control type drop down and input values: “Eyes, Lips & Complexion”
    2- Custom Field 2 with control type drop down and input values: “sub category names(I am assuming this is repetitive)”
    3- Custom Field 3 with control type drop down and input values: “Brand names”
    It automatically provides the functionality that you want. If you set Hide Blank Custom Fields setting in the Premium section under the Options Tab to Yes. Then the last custom field will show only those brands that are filtered by the drop-down above it. the sidebar options are updated based on the filter. All the features that you want pre-exist in the plugin, you just need to set up the catalogue in the right way. And decide whether you want a filter to be subcategory or a custom field.

    Best regards,

    Thread Starter quackounousa

    (@quackounousa)

    Thanks for the suggestion, I finally ended up doing something much easier, using CSS to show/hide the required dropdown, works very smoothly and doesn’t need much code tinkering for functionality other than a JS function.

    Now, how can I hide the number of products in each category, subcategory and custom field. Basically for Complexion (13), I would like to remove the “(13)”

    Thanks!

    You can use custom CSS for this. For example:

    .upcp-label span span {
    display: none;
    }
    
    Thread Starter quackounousa

    (@quackounousa)

    Added this but it’s still showing on the Dropdowns. What else do you suggest?

    Unfortunately, it is not possible to span tags inside the option tags in HTML. So, there’s no way to exclude the count with just CSS for the dropdowns. The only way would be to remove it directly in the code. It’s found in the “Shortcodes.php” file in the “Functions” folder.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Loading All Custom Fields In One Dropdown’ is closed to new replies.