I am trying to: I have created a Custom Search with two Between condition.
Link to a page where the issue can be seen: hidden link
I expected to see: When I insert the values into the Between range (min and max) I expected to see the result with the post that have the value between the range.
Instead, I got: I receive "No results"
Dear Francesco,
Please check these in your website:
1) You are follow our document to setup the custom field filters
https://toolset.com/documentation/user-guides/front-page-filters/#wpv-control-set-item
2) In case there are other compatibility problem in your website, please deactivate other plugins and switch to wordpress default theme, and test again
3) If the problem still persists, please provide a database dump file (ZIP file) of your website in below private detail box, I need to test and debug it in my localhost, thanks
Thanks for the details, I can download those files, and I am trying to duplicate same problem in my localhost, will feedback if there is anything found.
Here is what I found,
In the view "Ricerca Widget", you are querying posts of post type "Immobili"
But there isn't custom field "prezzo" in the "Immobili" posts, you can simply display them with Views shortcode in a single "Immobili" post:
[wpv-post-field name="prezzo"]
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153270
It does not output anything.
Since the custom field "prezzo" is not created with Types plugin,
so I checked it in database, table "wp_postmeta", run below SQL query:
SELECT * FROM `wp_postmeta` WHERE `meta_key` LIKE 'prezzo'
And I get lots of result, for example:
meta_id: 6681
post_id: 648
meta_key: prezzo
meta_value: 250000.00
The post ID is 648, which isn't a "Immobili" post, I tried to edit the post 648, but I get this error message:
Sorry, you are not allowed to edit posts in this post type.
So the post 648 isn't a "Immobili" posts, it is a "revision" post, and your filter won't be able to work.
Can you try to use this shortcode?
[wpv-post-field name="prezzo_gruppo_prezzo"]
because the field "prezzo" is a subfield of "prezzo_gruppo"
If there is custom field "prezzo_gruppo_prezzo" in each "Immobili" post, then the view's between filter should be able to work, see the result in your website:
hidden link
Max (€): 190000
There are three items in the result.
And I checked view "Ricerca Widget" in my localhost, in section "Query Filter", there are two filters using same URL parameter name "wpv-prezzo_gruppo_prezzo_min" and "wpv-prezzo_gruppo_prezzo_max":
a) prezzo_gruppo_prezzo is a number between URL_PARAM(wpv-prezzo_gruppo_prezzo_min), URL_PARAM(wpv-prezzo_gruppo_prezzo_max)
b) prezzo_gruppo is a number between URL_PARAM(wpv-prezzo_gruppo_prezzo_min), URL_PARAM(wpv-prezzo_gruppo_prezzo_max)
It would conduct some unexpected result, I suggest you test the filter one by one, if you only need to filter by custom fields "prezzo_gruppo_prezzo", I suggest you remove the second filter, only keep the first filter
Ok, I'm trying to solve, but I have the same issue with the "area_mq" field....
So, if you put 1 into min and 190000 to max you have "no results"...
I suggest you remove the second filter, only keep the first filter
I have do that, and now the price filter work fine.
So, now remain to solve the issue with the "area_mq" filter....
For the second filter:
prezzo_gruppo is a number between URL_PARAM(wpv-prezzo_gruppo_prezzo_min), URL_PARAM(wpv-prezzo_gruppo_prezzo_max)
Same as above post:
https://toolset.com/forums/topic/between-condition-dont-report-any-results/#post-584073
You will need to make sure there is custom field "prezzo_gruppo" in each "Immobili" post, and the field value is satisfied with the condition you are searching.
I checked it in your database dump file, all the custom field "prezzo_gruppo" are using empty value. you can simple run below sql query in your database:
SELECT * FROM `wp_postmeta` WHERE `meta_key` LIKE 'prezzo_gruppo'
I have solved the issue about the URL_PARAM(wpv-prezzo_gruppo_prezzo_min), URL_PARAM(wpv-prezzo_gruppo_prezzo_max).
Now remain to solve the issue about the "area_mq" field filter
There are two filters in the view "Ricerca Widget" which is related with the "area_mq" you mentioned above:
I am not sure which one is you talking about:
a) area_mq is a number greater than or equal URL_PARAM(wpv-area_mq_min)
Please run below SQL query in your database:
SELECT * FROM `wp_postmeta` WHERE `meta_key` LIKE '%area_mq%'
There isn't any custom fields using meta key area_mq in your website
So it won't be able to work
b) prezzo is a number between URL_PARAM(wpv-area_mq_min), URL_PARAM(wpv-area_mq_max)
I think I have aleady answer it in above post:
https://toolset.com/forums/topic/between-condition-dont-report-any-results/#post-584073
But there isn't custom field "prezzo" in the "Immobili" posts, so it won't be able to work too.
I suggest you try to setup the filters one by one by following our document, make sure the existed one is correct and work, then setup another one.
https://toolset.com/documentation/user-guides/front-page-filters/
So, the custom field should not be "prezzo" but "area_mq".... and "area_mq" exist, see the image that I have attached.
I checked again in the database dump file, same problem:
https://toolset.com/forums/topic/between-condition-dont-report-any-results/#post-584073
there isn't custom field "area_mq" in the "Immobili" posts, you can simply display them with Views shortcode in a single "Immobili" post:
[wpv-post-field name="area_mq"]
You will need to make sure there is custom field "area_mq" in each "Immobili" post, and the field value is satisfied with the condition you are searching.
So, I have solved the issue.
The problem was that it is not setted the "between" condition between min and max, but there was setted ">= min" and "<= max". I have modified the condition in "between" and now it work fine!