Advertisement:

Author Topic: (NEW PLUGIN) User-to-Item distance calculator  (Read 677 times)

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
(NEW PLUGIN) User-to-Item distance calculator
« on: February 02, 2018, 11:08:28 pm »
Hello everyone!

As you can see, I created a plugin. It's my first plugin, I love core changes and functions more, but I thought I could create one plugin and see what will people say about the plugin and the code itself.

This plugin calculates and displays the distance between a user (geolocation) and item (d_coord_lat/long). It also displays required time to travel to the item.

Data is calculated using Google Maps Distance Matrix API - thanks to https://goo.gl/532xZg.

On configuration page (conf.php) you can change distance unit - kilometres (default) and miles.

Data is shown using
Code: [Select]
<?php osc_run_hook('location')?> hook, which is under the description in most themes, but you can also use
Code: [Select]
<?php echo zop_showDistanceTime(); ?>, just comment osc_add_hook in index.php.


I hope you will like it. Post your reviews, if the plugin will be good, I will put it to market.

Thank you. Regards.

EDIT: Lol, forgot to upload plugin.

EDIT 2: It won't work for ads without coordinates, which could be a problem. If there will be more users without Google Maps plugin, I may include a geocoding function that will add coordinates to ads without them.
« Last Edit: February 03, 2018, 01:12:11 pm by patrickFromCroatia »

new_phpd

  • Newbie
  • *
  • Posts: 9
Re: (NEW PLUGIN) User-to-Item distance calculator
« Reply #1 on: March 29, 2018, 08:02:26 pm »
hy Patrick

just tested your plugin

1. At install i get this error:
The plugin generated 1 characters of unexpected output during the installation. Output: ""

2. on item page nothing shown even if i added <?php echo zop_showDistanceTime(); ?>
3. Browsers are asking for permission to view location
4. On modify/save between km/miles browsers pops up an info message with "unit updated" or something like that but still nothing on item page

i'm using osclass 3.7.4 tested on bender theme and osclasswizards theme