Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Sale price
This topic contains 12 replies, has 2 voices, and was last updated by mehul2700 4 years, 11 months ago.
- AuthorPosts
- March 6, 2018 at 10:02 am #17018
I 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 #17021Hi!
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.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 6, 2018 at 4:21 pm #17026What would you need to solve this?
March 6, 2018 at 5:07 pm #17027You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 6, 2018 at 5:33 pm #17029I have attached the plugin that I use.
Hope this helps.
WooCommerce simple storewide sale
March 6, 2018 at 5:47 pm #17030March 7, 2018 at 11:42 am #17036Hi!
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!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 7, 2018 at 7:36 pm #17038Hi,
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 #17040Hi!
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.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 8, 2018 at 4:14 pm #17043You cannot access this content.March 9, 2018 at 10:26 am #17053Hi!
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.
Best,
Thank you!
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 16, 2019 at 7:49 pm #22183You cannot access this content.April 16, 2019 at 8:28 pm #22184You cannot access this content. - AuthorPosts
The topic ‘Sale price’ is closed to new replies.