Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Sale price
- This topic has 12 replies, 2 voices, and was last updated 7 years, 1 month ago by
mehul2700.
-
AuthorPosts
-
March 6, 2018 at 10:02 am #17018
mehul2700
ParticipantI would like to know if there is away to show the sale price (discounted) in the search bar. I tried adding it in the advanced title field as mentioned in the knowledge base. However I do not use the sale price from woocommerce field and it use a plugin to show the discount on all my products.
Is there any {} code that I can use similar to {_sale_price} that I can use from the plugin?
March 6, 2018 at 1:30 pm #17021Ernest Marcinko
KeymasterHi!
It could be possible, but first I will have to know how those discount prices are stored. If it is some sort of custom field, then the advanced title field could work, but you will need to know the custom field name for that.
If it is something else, or there is a different way to get those prices, a custom code could still be possible to construct to get them.
March 6, 2018 at 4:21 pm #17026mehul2700
ParticipantWhat would you need to solve this?
March 6, 2018 at 5:07 pm #17027Ernest Marcinko
KeymasterYou cannot access this content.
March 6, 2018 at 5:33 pm #17029mehul2700
ParticipantI have attached the plugin that I use.
Hope this helps.
WooCommerce simple storewide sale
March 6, 2018 at 5:47 pm #17030mehul2700
ParticipantAttached zip
March 7, 2018 at 11:42 am #17036Ernest Marcinko
KeymasterHi!
Thank you very much for it, I have looked through the source code.
I have found a possible solution, but I am not sure I recommend using it. Let me explain. The plugin uses a very special method to apply the sales to the products. Basically it sets a temporary variable (transient) with the on-sale products to the currently listed page, and then uses this variable to check if any of the listed items are on sale. There is no function/method within the plugin that is able to check if an item is on a global sale based on the product only, as it also requires this page transient to be present.
I had to extract these two functions from the plugin to a separate function, and also create a filter to add the ‘fixed’ price to the results list. Please use this solution with caution, it may not work in all cases.
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!
March 7, 2018 at 7:36 pm #17038mehul2700
ParticipantHi,
Ernest, thank you so much for working on the custom code. You are a gem.
I copied the code as you mentioned in the functions.php file, however, the ajax search spinning wheel seems to be spinning and the search has stopped. Any other configs we need to do in the backend?
March 8, 2018 at 10:04 am #17040Ernest Marcinko
KeymasterHi!
Make sure that the code is copied correctly (from line 3 only). If you want, you can add temporary FTP access, and I will check it for you.
March 8, 2018 at 4:14 pm #17043mehul2700
ParticipantYou cannot access this content.
March 9, 2018 at 10:26 am #17053Ernest Marcinko
KeymasterHi!
Unfortunately I am not able to log-in via FTP with these details, my client says that either the username or password is incorrect. Can you please check that? If I need a special configuration in my FTP client, let me know.
Thank you!April 16, 2019 at 7:49 pm #22183mehul2700
ParticipantYou cannot access this content.
April 16, 2019 at 8:28 pm #22184mehul2700
ParticipantYou cannot access this content.
-
AuthorPosts
- The topic ‘Sale price’ is closed to new replies.