Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Sponsored Search Results
- This topic has 4 replies, 2 voices, and was last updated 8 years, 2 months ago by
PoliSafety IT Department.
-
AuthorPosts
-
March 26, 2018 at 9:05 am #17260
PoliSafety IT Department
ParticipantHello,
I would like to ask if it’s possible to add a “sponsored” product on search results.
Ex. – I have a promotional product that I want to show third on every search result with a tag “Promo” or as a new group if no search results are found.
I would also like to know if it’s possible when there is a variable product to show its variation name on the search results.
Thank you for your time.
Best regards.
March 26, 2018 at 2:51 pm #17281Ernest Marcinko
KeymasterHi!
Appending results between results is not really possible by configuration, but might be possible with a custom code.
Sponsored post
I have made a custom code that may work. I have tested it in few cases, but please be careful. Change the $id variable to the post ID you want to add as sponsored, and the $position variable to which position it should be.
Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
Variation name
As far as I know there is no such thing as variation name in WooCommerce. The product/variation titles are requested from WooCommerce itself, if it is filtered, it should return the vaues set in the database.
Is this perhaps a custom field that is set separately, or another feature, let me know, I can take a look at it.March 27, 2018 at 6:44 am #17294PoliSafety IT Department
ParticipantUnfortunately the code above did not work. I implemented it, cleared cache but the requested post did not show. I am not aware if it matters but I am using “Grouping” for the results and that may cause the issue.
Variation name
I not an expert in coding but I found a snippet below that can be used to extract the variation slug name in Woocommerce 3.0+ and might help you.Either way thank you so much for your time and effort.
March 27, 2018 at 10:18 am #17299Ernest Marcinko
KeymasterHi!
The grouping is definitely an issue, I don’t think it is possible with that feature enabled.
Variation Name
Thank you for that code. From what I can see, he is trying to add a specific product attribute to the variation title. He was using a different code, but that won’t work with the current WooCommerce version.
What I don’t understand is, what the variation title should be? Do you want to display product variation attributes within the product title?March 27, 2018 at 10:27 am #17302PoliSafety IT Department
ParticipantI apologize for the confusion since I don’t really know the correct term for the variation name.
I was referring to the names in the red box in the attached photo.
I would like these names to appear either next to the product title or as a different line below the title, when a variation is shown as a search result.Ex. To display variation SKUs on the search results we use _sku
-
AuthorPosts
- You must be logged in to reply to this topic.