Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Price Filter › Reply To: Price Filter
Hi,
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;
}