Product taxonomy in asp_result_groups

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Product taxonomy in asp_result_groups

This topic contains 6 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 11 months, 3 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #45319
    joshinmartin
    joshinmartin
    Participant

    Hi Team, Thank you for giving us the wonderful plugin. We used in a few of our client websites and it works perfectly.

    But, we are now getting stuck with a build for which we like to have your support.
    We would like to add a Woo product category to the asp_result_groups.
    We could not find anything in the documentation.

    Would you be able to provide the query code for this, please?

    Thank You,
    Joe

    #45333
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Joe,

    You can actually group by taxonomy terms (including woocommerce categories) via the settings, no code is required: https://i.imgur.com/qx69rIx.png
    That should do the trick 🙂

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #45340
    joshinmartin
    joshinmartin
    Participant

    Thank you, Ernest,

    Unfortunately, this doesn’t solve our issues :-(.

    We have the result group sections like ” page, posts and products ” already and we need to add a new tab from “woo product category” to the same result group. not as a separate result group.

    Sorry if I am still unclear to you.

    #45341
    joshinmartin
    joshinmartin
    Participant
    You cannot access this content.
    #45359
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    The code seems to be incorrect. There is this knowledge base article on how to exactly use the asp_results_groups hook.

    The main issue with your code is that you are tring to add items via query_posts to the live results list, however those are not compatible there. Instead of that, you should try ASP_Query. Something like:

    $args = array(
    	's' => '',
    	'_ajax_search' => true,
    	'post_tax_filter' => array(
    		array(
    			'taxonomy'  => 'product_cat',
    			'include'   => array(123), // Taxonomy term ID here
    			'allow_empty' => false // Allow results, that does not have connection with this taxonomy
    		)
    	)
    );
    $asp_query = new ASP_Query($args);
    $groupss = $asp_query->posts;
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #45371
    joshinmartin
    joshinmartin
    Participant

    Thank you – we made some progress now. We can see the titles of category now. But still, the content and link is not appearing in the result.
    You can see the test website here: https://tsw.detypedev.com/

    Can you check the code for us, please –

    $args = array(
    ‘s’ => $_POST[‘aspp’],
    ‘_ajax_search’ => true,
    ‘post_type’ => array(‘product’),
    ‘post_status’ => array(‘publish’),
    ‘posts_limit’ => 5,
    ‘keyword_logic’ => ‘AND’,
    ‘post_fields’ => array(
    ‘title’, ‘ids’,’content’, ‘excerpt’,’url’
    ),
    ‘post_tax_filter’ => array(
    array(
    ‘taxonomy’ => ‘product_cat’,
    ‘include’ => array(50),
    )
    )
    );
    $asp_query = new ASP_Query($args);
    $groupss = $asp_query->posts;

    #45382
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    It looks all right to me for the first sight.

    Can you check if there is anything within the $groupss variable?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

The topic ‘Product taxonomy in asp_result_groups’ is closed to new replies.