Custom Ajax Search Query For Custom Fields

This topic has 2 replies, 2 voices, and was last updated 12 months ago ago by Rose Tyler

  • Avatar: klacom
    klacom
    Participant
    November 28, 2023 at 07:56

    Hi,

    I want to search my products through _msku and _ean but I couldn’t find the related portion in your code where you wrote the logic for ajax search.

    I am able to do a normal search without a problem with:

    function custom_search_where($where){
        global $wpdb;
        if (is_search()) {
            $search_query = get_search_query();
            $where .= " OR (" . $wpdb->posts . ".ID IN (
                SELECT post_id
                FROM " . $wpdb->postmeta . "
                WHERE (meta_key = '_sku' OR meta_key = '_msku' OR meta_key = '_ean') 
                AND meta_value LIKE '%" . $search_query . "%'))";
        }
        return $where;
    }
    add_filter('posts_where', 'custom_search_where');
    

    Could you please point me to write portion of your code so I can edit it to take _ean and _msku into account.

    1 Answer
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    November 28, 2023 at 14:34

    Hello, Klacom,

    Thank you for contacting us and for using XStore.

    Regrettably, a simple customization will not suffice in this instance, as it involves changes to the plugin files. To achieve the desired customization, it will be necessary for our development team to implement all the required filters.

    We kindly request that you submit your inquiry through our task board page at the following URL: https://www.8theme.com/taskboard/

    Please note that our support forum is equipped to assist with existing options only and not with additional custom configurations.

    Thank you for your understanding.

    Kind Regards,
    8theme team

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.