Join our new community forum for support & discussion
Join NowHome › Support › Extensions › Geolocation › How to generate region for all the listings
How to generate region for all the listings
-
AuthorPosts
-
Inspares 9 months, 2 weeks ago
It is really hard to edit the location of all the listings one by one to generate regions.
I have 1000+listings, is there any option to generate regions for all the existing listings automatically.Please try this PHP snippet as temporary solution for listings created before the Regions feature release. Once you add it, please refresh the home page until all the regions are created, then delete this snippet (otherwise it’ll slow down the site):
add_action( 'template_redirect', function() { if(hivepress()->get_version('geolocation')){ $listing_ids = HivePress\Models\Listing::query()->order('random')->limit(50)->get_ids(); foreach ($listing_ids as $listing_id){ do_action( 'hivepress/v1/models/listing/update_longitude', $listing_id ); } } }, 1000 );
sjain702@gmail.com 9 months, 1 week agoHi,
I used the above code to generate regions. But seems am still confused with location search. I still have an issue where if i enter “India”, no results are displayed. but if I enter City, India then listing come up in search result.I followed both the steps of 1)Generating region 2) above code to update existing listings , but still no luck.
Could you please suggest what am i missing.
Please check if regions were generated after you used the above code snippet in Listings/Regions. If no regions were generated please make sure that you use a Google Maps API key without HTTP restrictions, or another option is using Mapbox (their API is easier for generating regions). Once you generate regions and India appears in Listings/Regions, listings will be found via the country search.
We do not have one yet, but it is pretty simple – once you enable it in settings, regions will be generated automatically in Listings/Regions, these are similar to listing categories. Please make sure that there is an API key without HTTP restrictions (restrict quotas instead if required), we recommend using Mapbox for regions instead of Google Maps.
kanazenda 9 months, 1 week agook and we can classify and display the regions as we want or it’s automatic (only cities or countries)? I will try soon to see the rendering
If you mean code snippet above then once you add it regions will be created automatically on each refresh of some page of your website. We recommend to refresh the home page until all the regions are created, then delete this snippet (otherwise it will slow down the site):
-
AuthorPosts
New Reply
This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.