This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Ajax Search to respect visibility set by B2BKing #37434
    erikleirdalerikleirdal
    Participant

    B2BKing replied. I have not tested the Free version of you so I dont know if that works. But this is their code,

    add_filter(‘asl_query_args’, array($this, ‘asl_query_args_postin’), 10, 1);
    function asl_query_args_postin($args) {
    $args[‘post_in’] = is_array($args[‘post_in’]) ? $args[‘post_in’] : array();
    if (!defined(‘ICL_LANGUAGE_NAME_EN’)){
    $allTheIDs = get_transient(‘b2bking_user_’.get_current_user_id().’_ajax_visibility’);
    } else {
    $allTheIDs = get_transient(‘b2bking_user_’.get_current_user_id().’_ajax_visibility’.ICL_LANGUAGE_NAME_EN);
    }
    $allTheIDs = apply_filters(‘b2bking_ids_post_in_visibility’, $allTheIDs);
    $currentval = $args[‘post_in’];
    if (!empty($currentval) && $allTheIDs !== false){
    $allTheIDs = array_intersect($allTheIDs, $currentval);
    }

    if ($allTheIDs){
    if(!empty($allTheIDs)){
    $args[‘post_in’] = array_merge($args[‘post_in’], $allTheIDs);
    }
    }
    return $args;
    }

    in reply to: Ajax Search to respect visibility set by B2BKing #37424
    erikleirdalerikleirdal
    Participant

    Thanks. I’ll take your answer to B2BKing 🙂

    in reply to: Ajax Search to respect visibility set by B2BKing #37413
    erikleirdalerikleirdal
    Participant

    I found this online, from the request from B2BKing themself. But adding this to code snippets doesnt seem to do the trick. Hidden products still show up in Ajax Search.

    add_filter(‘asl_query_args’, ‘asl_query_args_postin’, 10, 1);
    function asl_query_args_postin($args) {
    $args[‘post_in’] = is_array($args[‘post_in’]) ? $args[‘post_in’] : array();
    $args[‘post_in’] = array_merge($args[‘post_in’], array(1,2,3));
    return $args;
    }

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