Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Price Filter
- This topic has 15 replies, 2 voices, and was last updated 6 years ago by
Alex Meda.
-
AuthorPosts
-
April 23, 2020 at 7:07 pm #26876
Alex Meda
ParticipantHi,
I recently purchased your plugin and I’m really enjoying my experience so far but it would be far more interesting if you were willing to solve two 2 issues that I’m dealing with now.As a matter of fact, I’ve attached 4 screenshots to this support ticket explaining very clearly the 2 issues that I mentioned above:
ISSUE #1
Screenshot #1 named ”Ajax” clearly identifies the issue and suggests me to check the “.htaccess” file but I don’t know exactly what to do whith my “.htacces” file in order to resolve it. (Please take a look at Screenshot #1)ISSUE #2
Screenshot 2 named “Pricing_Form”, this is my website post template for users who offer various type of service and choose which method to charge their clients by filling out the fields that are clearly identified, (Please take a look at Screenshot #2)Screenshot #3 named “Pricing_Slide” is my “Ajax Price Filter”. And as you already know, only one “custom field” can be assigned and in that case it’s “hourly_fees” but I want the price filter to include “weekly_fees” and “monthly_fees” if one of them is checked (Please see Screenshot #3)
Screenshot #4 named “Result” is actually the filters bar display
QUESTIONS
1-) How do I create a single “Price Filter” that will get all the values of 3 different fields (“hourly _fees”; “weekly_fees”; “monthly_fees) when one of the 3 is checked.:
For example, if I check on “monthly_fees” then the Price Filter should only get services which are monthly charged OR…2-) How do I create 3 different Price Filters, each one of them is assigned to the value of a specific field (“hourly_fees” for example) and by default those Price Filters are not triggered until I check the option to which the Prrice Filter is associated
Your tech support and your time are both highly appreciated! You are the best team ever!
My best regards.April 24, 2020 at 1:51 pm #26893Ernest Marcinko
KeymasterHi,
Thank you very much for the details, I hope I understood everything correctly.
1. The .htaccess problem
That happens, when there is either an incorrectly set mod_rewrite redirection rule in the .htaccess file, or there is different rewrite rule in effect – it can be set by a plugin, or maybe the general permalink structure is incorrectly set.
The issue is triggered, whenever the ajax handler cannot be accessed. This issue is unfortunately very hard to debug.
– First, I suggest checking the https://yoursite.com/wp-admin/admin-ajax.php URL. Copy and paste that to the browser, obviously change the yoursite.com to your domain, and see what comes up. The results should be a white page with either 0 or -1 printed to it. If it’s not, then there is a rewrite rule defined somewhere.
– Then check if the site URL is set correctly across the WordPress back-end, usually www and non-www versions of the site are the problem – it should be the same everywhere.2. Well, this is only possible via custom coding. Dynamically updating/conditional filters are not yet implemented. Probably using a single price filter, and then changing the price filter key based on the selection (via a custom code) is the easiest solution.
April 25, 2020 at 1:34 am #26897Alex Meda
ParticipantHi,
It’s been great reading you and from your technical support, I’m reporting you the following status which represent the above listed issues results:Resolving Issue #1 ( “.htacces file” )
I checked out both solutions you gave concerning the current issue and I found out that it was actually a plugin (named Duplicator Pro) which is still causing the problem even though I already uninstalled it. The screenshot named “.htaccess” shows you exactly the concerned file and since I honestly don’t know yet how to modify it correctly, your wisdom on that would be very much appreciated.Resolving Issue #2 ( “Price Filter” )
To make it short, I made some research all over Google but I hardly found a way to achieve my goal…Therefore I would be the happiest if you were willing to share a ” Code Sample” to start or some other suggestions.Once again, thank you so so much!
April 27, 2020 at 9:18 am #26913Ernest Marcinko
KeymasterHi,
1. That looks like the default .htaccess file to me, so it should be all right. There might be an different rewrite rule then, that is not within the .htaccess defined.
What do you see when you open the https://yoursite.com/wp-admin/admin-ajax.php URL? (change yoursite.com to your website address of course)2. Usually I recommend a ready-to-use custom code if I can, but this more complicated than that. I would definitely start with this. (at the start of that page, you can see how that hook is accessed) That variable allows you to access the post meta filters, right before the search starts. You can loop through them, check the values, change the values etc..
So, I would try to loop through the filters, find the value of the selected pricing type, and then based on that, find the price filter, and change it’s key to the desired price key.I have quickly made a sample code, that could be a very good start:
add_filter("asp_query_args", "asp_query_args_change_pricing", 10, 2); function asp_query_args_change_pricing($args, $search_id) { // Pricing "type" meta key $pricing_type = "pricing_type"; // The default price meta field key $price_key = "hourly_fees"; // The pricing type to price meta field key resolution $price_array = array( // Value of the pricing_type meta field => key of the price field "hourly" => "hourly _fees", "weekly" => "weekly_fees, "monthly" => "monthly_fees" ); $value = ''; // 1. Get the pricing type value forach ( $args['post_meta_filter'] as &filter ) { if ( $filter['key'] == $pricing_type ) { $value = $filter['value']; break; } } // 2. Change the price field key, based on the pricint type value if ( $value != '' ) { forach ( $args['post_meta_filter'] as $k => &filter ) { if ( $filter['key'] == $price_key && isset($price_array[$value]) ) { $args['post_meta_filter'][$k]['key'] = $price_array[$value]; } } } return $args; }April 27, 2020 at 11:02 pm #26934Alex Meda
ParticipantYou cannot access this content.
April 27, 2020 at 11:07 pm #26939Alex Meda
ParticipantYou cannot access this content.
April 28, 2020 at 1:25 pm #26956Ernest Marcinko
KeymasterHi,
Thank you for your kind words 🙂
Well, the issue is then, that the plugin for some reason tries to query the secure version of the handler URL, staring with “https://”, while the site is running “http://”, that perfectly explains the issue.
That URL is requested from WordPress, so I suspect that somewhere on the site back-end, the site URL is not configured correclty. It should behttp://partaxpress.com/wp-admin/admin-ajax.php
If that is correct, then this might be changed via a custom code somewhere. It needs to be corrected for sure, because that ajax handler URL is used by the WordPress core as well.April 28, 2020 at 5:29 pm #26968Alex Meda
ParticipantYou cannot access this content.
April 29, 2020 at 7:52 am #26984Ernest Marcinko
KeymasterYou cannot access this content.
April 29, 2020 at 5:35 pm #27017Alex Meda
ParticipantHi,
I did exactly what you told me but it’s not working yet but I was still wondering if by purchasing the SSL, this should solve the problem ?April 30, 2020 at 8:12 am #27025Ernest Marcinko
KeymasterThat is very interesting, that should have worked.
Using SSL will do the trick, but you don’t have to spend money on that. I recommend using cloudflare instead. They have shared SSL certificates, that are free. We actually use them on all of our sites, it is great. I think they have a wordpress plugin as well, to make it easier to set up.
May 2, 2020 at 5:48 pm #27063Alex Meda
ParticipantHi,
Thank you very for your suggestion but I recently did some deep research on how to resolve the issue and you probably won’t believe what happened. I accidentally landed on one of your support advice for another client who has been dealing with the same issue as I am actually. When I applied it, the issue has been successfully resolved. On the screenshot below you’ll see your own solution .May 4, 2020 at 8:04 am #27067Ernest Marcinko
KeymasterOh indeed, I forgot about that, I’m sorry.
The core issue is however still there, because the default ajax handler steel needs to be accessible for WordPress. This sort of bypasses the issue with the plugin, but in I still suggest investigating further when possible.May 6, 2020 at 9:28 pm #27150Alex Meda
ParticipantAgain, thank you so so much for all the time that you wisely invested in helping me to solve my website issue.
May 7, 2020 at 7:46 am #27151Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- The topic ‘Price Filter’ is closed to new replies.