Forum Replies Created
-
AuthorPosts
-
itsjonesyy70
ParticipantThanks Ernest, that would be great if you could roll out a fix!
I can say for sure that in my scenario, multiple uses of a variable will not function. (result container header – info box text):
<a href="?post_type=product&s={phrase}">View all product results</a> (link functions correctly for this button) <a href="?s={phrase}">View all blog results</a> (link for this button will not work as phrase already used)I have not tested multiple uses of the same variable in the ‘redirect to url’ or on ‘show more url’ settings but I would guess the same happens
-
This reply was modified 3 years, 11 months ago by
itsjonesyy70.
itsjonesyy70
ParticipantAh, sorry I missed this. Not able to use the override otherwise my results filtering breaks. So to confirm, search override has to be enabled in order to catch the fast search queries in statistics?
itsjonesyy70
ParticipantAm currently on 4.21.5 and it doesn’t look like anything has changed. A fast search query before results are previewed does not appear in statistics.
itsjonesyy70
ParticipantHi Ernest, is there an ETA for when this will be fixed?
Thanks
itsjonesyy70
ParticipantOK, that would be great 🙂
Thanks
itsjonesyy70
ParticipantHi ernest,
Thanks for the update.
Maybe this helps – I’ve noticed that the issue of searches not being logged only occurs when the return key is pressed very fast (so before the preview results have even appeared). If the user types their query, waits a second for preview to load and appear, then presses return, it will be logged in statistics as normal. This is without any custom code applied.
So currently the custom code (old and new variation) does not have any impact on the fast return key presses.
Thanks again.
itsjonesyy70
ParticipantHi,
The code doesn’t seem to fix it. I have tested searches with a return key press and they still do not appear in statistics. The code also breaks the plugin preview results.
The access link is still usable, please let me know if you need any more informationitsjonesyy70
ParticipantLess complex than that – a few fixed values (for my product categories) that appear when the input field is focused. They will be hyperlinked. There’ll be no smart suggestion or search initiation involved.
Would that still take a lot of effort to create?
Thanks
-
This reply was modified 4 years, 7 months ago by
itsjonesyy70.
itsjonesyy70
ParticipantYes they do. Default woo search only looks in titles, and it will still find results if I search for ‘te’ , ‘tes’, products with the name test1, test2, will appear.
But of course I need the code so the woo search can look inside taxonomies too, and it should work with partial queries.The code serves the purpose of ‘mirroring’ what your plugin is showing for results – I need it to do this so it my filtering will be fully compatible.
1. Search with ajaxsearchpro
2. preview list appears
3. user proceeds with clicking magnifier or enter key or view more button
4. user redirected to woo archive
5. Woo archive is now showing results from default woo search, in order to be compatible with filtering. Hence I’m trying to get woo search to look in tax, attr, with partial matches.My code is nearly there but just doesn’t work with partial queries.
Please say if I’m not making sense as this has become a bit of a weird setup.
Thanks again
itsjonesyy70
ParticipantHi ernest – me again.
I’ve managed to create a mostly working solution to the issues above (where the results should be filterable) but could just do with your thoughts on one more thing. I appreciate this is out of bounds of plugin support, so please let me know if the fix is very complex and I won’t bother you anymore on this. But I’m hoping it’s a quick fix.
To summarize what we discussed before, I needed default woocommerce results to be displayed so they are filterable, which ajax search pro can do. I also needed the results to behave similarly to how ajax search pro produces preview results (search deeper in taxonomy, attributes). I now have a snippet that makes default woo results look deeper in taxonomy and attributes. It works exactly as I need but is missing one thing – displaying results from partial searches (like your plugin can do).
For example, I have a product tax value called ‘fashion’, it needs the full term to be typed for results to appear on archive. If I type ‘fash’, or ‘fashio’, and search, no results will appear. I’m trying to get it to work without the need for exact match.
Here’s the snippet that works with exact match only – if there is a quick fix to make it work with partial searches too, please let me know! Noone else on the internet has been able to help and I’ve tried everywhere! :
add_filter( ‘posts_search’, ‘woocommerce_search_product_tag_extended’, 999, 2 );
function woocommerce_search_product_tag_extended( $search, $query ) {
global $wpdb, $wp;$qvars = $wp->query_vars;
if ( is_admin() || empty($search) || ! ( isset($qvars[‘s’])
&& isset($qvars[‘post_type’]) && ! empty($qvars[‘s’])
&& $qvars[‘post_type’] === ‘product’ ) ) {
return $search;
}// Here set your custom taxonomies in the array
$taxonomies = array(‘product_cat’, ‘pa_region’);$tax_query = array(‘relation’ => ‘OR’); // Initializing tax query
// Loop through taxonomies to set the tax query
foreach( $taxonomies as $taxonomy ) {
$tax_query[] = array(
‘taxonomy’ => $taxonomy,
‘field’ => ‘name’,
‘terms’ => esc_attr($qvars[‘s’]),
);
}// Get the product Ids
$ids = get_posts( array(
‘posts_per_page’ => -1,
‘post_type’ => ‘product’,
‘post_status’ => ‘publish’,
‘fields’ => ‘ids’,
‘tax_query’ => $tax_query,
) );if ( sizeof( $ids ) > 0 ) {
$search = str_replace( ‘AND (((‘, “AND ((({$wpdb->posts}.ID IN (” . implode( ‘,’, $ids ) . “)) OR (“, $search);
}
return $search;
}itsjonesyy70
ParticipantGreat, thanks again.
itsjonesyy70
ParticipantOK, thank you for the change and the information 🙂
To confirm, what were the plugin changes made for compatibility with A-Z, Z-A ordering? And will anything be changed after a plugin update?
Thanks
itsjonesyy70
ParticipantYou cannot access this content.
itsjonesyy70
ParticipantYou cannot access this content.
itsjonesyy70
ParticipantYou cannot access this content.
-
This reply was modified 3 years, 11 months ago by
-
AuthorPosts