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 12 months ago.
- AuthorPosts
- September 9, 2023 at 10:24 am #45319
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,
JoeSeptember 11, 2023 at 12:18 pm #45333Hi Joe,
You can actually group by taxonomy terms (including woocommerce categories) via the settings, no code is required: https://i.imgur.com/qx69rIx.png
Best,
That should do the trick 🙂
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 11, 2023 at 1:59 pm #45340Thank 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.
September 11, 2023 at 2:00 pm #45341You cannot access this content.September 12, 2023 at 5:31 pm #45359The 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:
Best,$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;
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 13, 2023 at 3:22 pm #45371Thank 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;September 14, 2023 at 6:15 pm #45382It looks all right to me for the first sight.
Can you check if there is anything within the
Best,$groupss
variable?
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
The topic ‘Product taxonomy in asp_result_groups’ is closed to new replies.