Advanced search CPT
This topic contains 22 replies, has 4 voices, and was last updated by Silvia Frati 6 years, 6 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: advanced search, CPT, localization, region, search
-
AuthorPosts
-
May 3, 2018 at 4:36 pm #428975
Hello,
I know it is possible to add some sort of custom field to the search form but i think i need something slightly different. I’ll try to explain what i need.
The basic configuration of GD allows you to search over categories, text and nearby.
First of all i need to disable the nearby part, i did it with some action so that’s fine.The field i would need to add would be a list of “administrative area” (that’s how they are marked into Google Maps API JSON results). I’m thinking if it is possibile to add a new CPT with GD, insert into that all the administrative area i need and then add this list, using a multi-select, in the search form.
It would be perfect if i could add this to the new place form as well, because gd_town and gd_region are not enough for me, i need that administrative area.
I don’t know if i explained it clearly but that’s what i need, is it possible in any way w/o going into code too much using GD?
Thank you,
DiegoMay 3, 2018 at 5:19 pm #428989Is it the neighborhood?
Can you give us an example?Please provide some details including an example listing link so we can take a look:
Listing URL where we can see the issue:
WordPress Credentials
WP Admin Login URL:
WP Admin Username:
WP Admin Password:May 7, 2018 at 7:59 am #429351Hi Alex,
It is not the neighborhood, its something in the middle of town and region, or to say it in another way, it rappresent a collection of town.
My testing website is only local on my machine atm, so i cannot provide any link/login credentials. Actually i think it’s not needed, i just wanted to know if this is feasible with the existing GD structure.
This image is just for example purpose, the example itself has no meaning in real world in USA, but it will help describe what i need. Given the example image think as if: “Bethesda, Silve Spring, Adelphi, College Park, Hyattsville” are a group of town called “OurGroupOfTown”.
I would need a way to search over this “custom groups” of town, GD allows to search for single town (like Bethesda of our example map) or region: “State of Washington”.
That’s why i was asking if it was possible to use GD CPT to create the list of “OurGroupsOfTowns). I don’t need a place to to define which towns form which GroupOfTown, i just want a list of those and to be able to search inside that.
Hope that’s more clear now,
Thank you,
DiegoMay 7, 2018 at 9:00 am #429360I do not think it is possible to restrict a search to IN several locations (ex. 1,5,9,10) but I will forward your question to see if there is a fix for that.
May 7, 2018 at 9:05 am #429366Hi Diego,
Its not possible to select several locations at once.
Can you not use the NEAR search with a specific distance limit to replicate somthing like that?Stiofan
May 7, 2018 at 9:16 am #429367Thank you for the quick answers,
@stiofan: looking into the db i think it could be as simple as adding to $wpdb-prefix.’_geodir_gd_place_detail’ (Using the std “place” CPT) inside the post_locations column, one more [] value, ATM i have in order: [town],[region],[country] inside there. If only i could make GD add there a new value, say “OurGroupOfTown” i would only miss later to be able, using a <select> to pick up one of those values in the advanced search form.
I cannot use the NEAR function because it is not so accurate according to my customer request, additionally the NEAR functions starts from the GoogleMaps center of a given town/region and goes in a radius, my group of town can be distrubed in such a way that conflict with the radius thing
Should i give up hoping it could be done w/o hacking into the GD code?
May 7, 2018 at 9:30 am #429369Its not possible by default just now.
We are looking into giving more option than having the near search only ordered by distance.Stiofan
May 7, 2018 at 9:33 am #429370@stiofan One last question: would it be possibile doing something with a brand new CPT created by GD and add that as a search parameter on the default “place” CPT advanced search form?
May 7, 2018 at 11:41 am #429380How about if we try to say it a different way.
Here is a near search URL
https://wpgeo.directory/supreme-directory/?geodir_search=1&stype=gd_place&s=+&snear=OurGroupofTowns&sgeo_lat=37.7749295&sgeo_lon=-122.41941550000001That is without any modifications of the core, which are not advised and should not be necessary.
RE your question about CPTs, that is not what the CPT addon was designed for.
May 7, 2018 at 12:36 pm #429386@alex What’s the database behind that? Simply using the string “OurGroupOfTown” (of using my real data) wouldn’t still present me the correct result because i have no way to map those “OurGroupOfTown”. That is why i was thinking of using a new CPT in the first place, to store the “OurGroupOfTown”.
Ofc my plan is NOT to edit the real GD core, but instead using its filter/action to hook something custom, editing core is my real last hope. Building it all from 0 would be a pain, and the customer (as always) stress 😀
May 7, 2018 at 12:43 pm #429387Hace you tried the near search?
What’s the problem with it, exactly?
Havw you already added placeholder listings to those Locations to see how it works?
Try that and let us know how it goes.
May 7, 2018 at 1:09 pm #429389@alex:
Yes, i did try near search. The problem is that near search allows a radius search, but for my customer i need something slightly different. My final search should be like searching on a list of towns, but i can’t really place it there in this way, that’s why i need those “Groups”.Google Maps Javascript API (since i could test it on their website) was calling these entities, that I’m trying to obtain here, “Administrative Area”. Or at least it was so for my country.
I have some dummy data, and i can tell that indeed the near search isn’t good for my use-case
May 7, 2018 at 1:13 pm #429391It is possible to search IN region OR city so you can try those, and with location in the URL location pages already contain all listings in the locatoin, or can, with the right widgets.
May 8, 2018 at 8:44 am #429484May 8, 2018 at 11:12 am #429507My final search should be like searching on a list of towns, but i can’t really place it there in this way, that’s why i need those “Groups”.
Let us know more details about what you are trying to achieve and we can try to advise.
Google Maps Javascript API (since i could test it on their website) was calling these entities, that I’m trying to obtain here, “Administrative Area”. Or at least it was so for my country.
This is ‘city’ and ‘region’ and ‘neighborhood’ generally speaking. Recreating the Multilocations functionality is non-trivial. That is why we are trying to get more details about what you are looking for, like, what should the ‘search form’ look like or the ‘search results page’ look like.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket