Open JackAlexander1 opened 6 years ago
Or another possible solution which would be less code:
if (
isset( $_REQUEST['department'] ) && $_REQUEST['department'] != 'residential-lettings' &&
isset( $_REQUEST['maximum_price'] ) && $_REQUEST['maximum_price'] != ''
)
Hi Jack,
Thanks for your comments. The reason you can't generally search by price on commercial properties is that a commercial property can be for sale, to let, or both. As well as that, a commercial property can have a price range which further complicates things.
A third complication is that a price can have a unit. So you can enter prices as £15000, or as £15 per sq ft. I don't know how a property entered with a price of £15 per sq ft would come up when searching for a price range of £x - £x.
I've looked at a number of commercial agents sites, as we did when we took this decision and none of these allow search by price, probably for some of the aforementioned reasons:
https://www.carterjonas.co.uk/commercial http://www.knightfrank.co.uk/contact/commercial-agents-birmingham http://burleybrowne.co.uk/propertysearch.aspx .. and many more (these are just the first 3 commercial agent sites I came across)
It seems that type and floor area are definitely the primary search filters.
I'm open to discussion and always open to ideas on how the plugin can be improved so have a read of the above and if you have any comments or workarounds for the issues mentioned I'm all ears.
Thanks, Steve
Hey Steve,
Reading all of that really cleared up a lot and it makes a lot of sense why this isn't implemented. That is a lot of variables to deal with.
A suggestion that I think would work would be adding a new option that runs off the Available As option in the property settings. You could have that be a drop down with either For Sale or To Let as options (with another option of all) and then depending on what is selected, have either Min and Max for Sales or Min and Max for Lettings appear.
I've been playing around with something similar in my theme, I've been adding in a custom form_control in search-form.php (my theme overwrites these templates set in the propertyhive plugin) to allow users to separate by Availability. By default its on For Sale and this works fairly well. Even if it's both, it still shows them.
Let me know what you think about the above and hopefully we can come up with a good solution for this issue!
Thanks,
Jack
Hi there,
I've been trying to use these search terms for a site that I'm building and it appears it doesn't work for Commercial Properties. Upon further investigation it appears that it is only allowing the
residential-sales
department to use the meta query.To remedy this I would suggest putting this instead of the current department check.
https://github.com/propertyhive/WP-Property-Hive/blob/master/includes/class-ph-query.php#L794-L843
Thank you, hope to hear from you soon