Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ajax Search pro – incorrect woocommerce product links in search result
This topic contains 2 replies, has 2 voices, and was last updated by miag 8 years, 8 months ago.
- AuthorPosts
- January 31, 2015 at 12:35 am #3728
Uses Ajax Search pro on a WP multisite, http://www.humlebyns.se
Works great except for http://www.humlebyns.se/hundbutik where we have a Wocommerce shop.
It looks like a permalink problem, a search for schampo at http://www.humlebyns.se/test/ result in a list with schampo in the shop, but associated links are incorrect, i.e http://www.humlebyns.se/hundbutik/espree-luxury-tar-sulfa-schampo-355-ml/, when it should be http://www.humlebyns.se/hundbutik/produkt/espree-luxury-tar-sulfa-schampo-355-ml.The shop uses SSL, no problems with that.
Ajax Search pro – No Errors found
Ajax Search pro is activated for networkHope you can give me a hint, otherwise I will provide login data.
MichaelFebruary 2, 2015 at 11:29 am #3731Hi!
I did a bit of a research, and this might be a wordpress related bug. The search uses the general get_permalink() function to return the correct url, but for some reason it fails. Before touching anything you should try these steps:
- Save the permalink settings again on the wordpress settings panel
- Deactivate/activate WooCommerce and Ajax Search Pro
This should refresh the permalink cache, and it might help.
If not, then another solution is to connect a function to the results link filter and add the “produkt” part manually:
If the upper mentioned solutions are not working, then add the following code to your themes functions.php file. It will try to fix the url.
Best,add_filter( "asp_results", "asp_fix_woocommerce_link", 1, 1 ); function asp_fix_woocommerce_link( $results ) { $home_url = home_url(); if (strpos($home_url, "hundbutik") === false) { foreach ($results as $k=>$v) { $results[$k]->link = str_replace("hundbutik/", "hundbutik/produkt/", $results[$k]->link); } } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 3, 2015 at 1:14 am #3771Hi
The first action to refresh the permalink cache didn’t work.
Added the filter to my child theme function.php, fixed.Thank’s
Michael - AuthorPosts
You must be logged in to reply to this topic.