Advanced search CPT

This topic contains 22 replies, has 4 voices, and was last updated by  Silvia Frati 5 years, 12 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #428975

    Silvia Frati
    Expired Member
    Post count: 30

    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,
    Diego

    #428989

    Alex Rollin
    Moderator
    Post count: 27815

    Is 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:

    #429351

    Silvia Frati
    Expired Member
    Post count: 30

    Hi 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.

    Washington

    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,
    Diego

    #429360

    Alex Rollin
    Moderator
    Post count: 27815

    I 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.

    #429366

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi 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

    #429367

    Silvia Frati
    Expired Member
    Post count: 30

    Thank 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?

    #429369

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Its not possible by default just now.
    We are looking into giving more option than having the near search only ordered by distance.

    Stiofan

    #429370

    Silvia Frati
    Expired Member
    Post count: 30

    @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?

    #429380

    Alex Rollin
    Moderator
    Post count: 27815

    How 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.41941550000001

    That 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.

    #429386

    Silvia Frati
    Expired Member
    Post count: 30

    @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 😀

    #429387

    Alex Rollin
    Moderator
    Post count: 27815

    Hace 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.

    #429389

    Silvia Frati
    Expired Member
    Post count: 30

    @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

    #429391

    Alex Rollin
    Moderator
    Post count: 27815

    It 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.

    #429484

    Silvia Frati
    Expired Member
    Post count: 30

    Thank you both @alex and @stiofan for the support. I guess i’ll have to dig into the GD code and find a way to hook in it to achieve what i need.

    Cheers,
    Diego

    #429507

    Alex Rollin
    Moderator
    Post count: 27815

    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”.

    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.

Viewing 15 posts - 1 through 15 (of 23 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket