Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro How to customize the search form for end of users?

Viewing 6 posts - 1 through 6 (of 6 total)
  • delkhanna
    #21042

    Hi,

    My question is how to customize the search form for end users.
    My situation is here, I have added a list countries in user registration form by ACF field. and I(as a admin) can assign to a user a country (or more than one country) which country he can search products.
    for example I created a user ‘TEST1’ and assign country Italy. so he can search only the products from Italy.so In the search form user(TEST1) can see only assigned country and he can search products only from assigned country.

    I am sharing some screen shorts, what I have done so far.

    https://imgur.com/a/FGgw0

    Any help/suggestion is highly appreciated.

    delkhanna
    #21095

    Done.. its simple.. just call the specific meta data and login user..
    Code is here.. 😉

    $user_id = get_current_user_id();
    $all_meta_for_user = get_user_meta($user_id);
    $country_array = unserialize($all_meta_for_user[‘information_company’][0]);
    $countrychildren = array();
    foreach ($country_array as $meta_op) {
    $tempobject = array();
    $tempobject[‘term_id’] = $meta_op;
    $tempobject[‘cat_name’] = $meta_op;

    $countrychildren[] = (object)$tempobject;
    }
    if ($field_data[‘meta_key’] == ‘information_company’) {
    $returnvar .= $this->create_input->generate_multiselect($countrychildren, $field_name, $defaults, $elem_attr);

    }

    delkhanna
    #21098

    added in class-search-filter-display-shortcode.php file.

    Admin you can close this topic.. Thanks 🙂

    Ross Moderator
    #21106

    I’m slightly confused about what you are trying to achieve, but am very interested in what it might be!!

    Would you be able to send me a link when you’ve gone live with the site (or a screen shot)? It could be something to incorporate to the plugin 🙂

    Thanks

    delkhanna
    #21179

    Hi Ross,

    As I have talked above, my idea to restrict users to search the product for particular (one or more )country. So I added the list of country field in user registration field and only admin can see this field.

    I replaced my modified code for country in the search form. the project is still under showcase. I am glad to share here..

    https://imgur.com/a/jYZTl

    Ross Moderator
    #21197

    Ah I see nice, yeah I think I need to add a filter or something so that users are able to create their own custom filters more easily 🙂

    Thanks

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

The forum ‘Search & Filter Pro’ is closed to new topics and replies.