Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Error Searching for Product Categories
- This topic has 5 replies, 2 voices, and was last updated 5 years, 8 months ago by
Ernest Marcinko.
-
AuthorPosts
-
September 23, 2020 at 10:05 pm #29512
yonahs61332
ParticipantWhen we search for our products like Lipitor, it works great…
When we search for some Product Categories, it also works OK, like Acne or ADHDBut other product categories return an error like Blood Pressure or Cholesterol I get:
“The request failed. Please check your connection! Status: 500”can you please help me?
September 24, 2020 at 9:09 am #29519Ernest Marcinko
KeymasterHi,
Sure! Can you please add temporary FTP and back-end access? I would like to debug the query. Thank you!
September 24, 2020 at 9:17 am #29520yonahs61332
ParticipantYou cannot access this content.
September 24, 2020 at 12:31 pm #29526Ernest Marcinko
KeymasterThank you!
I think I found the issue. On the General Options -> Sources 2 panel, you had some taxonomy terms selected to be returned as results, which I think you didn’t want. You only needed to search the taxonomies and return the products, so I disabled those option. Now it should work all right.
September 24, 2020 at 8:45 pm #29538yonahs61332
ParticipantThanks, that removed the error, but also removed a function that we want.
We also want to be see a “Category” box when the term searched for matches a category
September 25, 2020 at 1:56 pm #29547Ernest Marcinko
KeymasterHi,
The issue is caused by a custom code. I cannot tell where exactly it is, I could not find it in the child theme directory. It is probably related to something like this:
add_filter( 'asp_results', 'asp_add_custom_shortcode', 10, 1 ); function asp_add_custom_shortcode( $results ) { foreach ($results as $k=>&$r) { // Enter the shortcode into the quotes section $r->content = do_shortcode('[my_shortoce_here]') . $r->content; } return $results; }I suspect the “do_shortcode” is not working correctly within the terms context. Try modifying the final code to something like:
add_filter( 'asp_results', 'asp_add_custom_shortcode', 10, 1 ); function asp_add_custom_shortcode( $results ) { foreach ($results as $k=>&$r) { if ( isset($r->post_type) ) { // Enter the shortcode into the quotes section $r->content = do_shortcode('[my_shortoce_here]') . $r->content; } } return $results; } -
AuthorPosts
- You must be logged in to reply to this topic.