If this is your first visit, check our documentation. To post, register or login.
Forums / Addon Shipping Modules / Mileage based shipping module?

Mileage based shipping module?

Started by fjolsvith on 22 Mar 2016, 7:37 PM · Views: 19,555

Results 21 to 33 of 33
2 Aug 2016, 9:07 PM
#21
jeffwebb avatar

jeffwebb

New Zenner

Join Date:
Jul 2005
Location:
Tennessee, USA
Posts:
11
Plugin Contributions:
0

Mileage based shipping module?

Just uploaded v1.5

"Door to Door" now rather than zip code to zip code. Added option to limit delivery area by actual distance.

Some things I would like to do to improve this Plug in are:
a. Make the drop-down show street address along with the city, state, zip code and country.
b. Add a configuration option for the shipping origin(s) other that the store location. Perhaps by adding an attribute for each product.
c. I guess its not specific to this Plug in, but when the customer isn't logged in the distance still can't be calculated closer than the Zip Code. Fixing that is a little advanced for me right now. Could make a big difference in whether a potential customer goes through the trouble of creating an account.
d. The calculation doesn't account for the free distance. For example: Free delivery area is 1 mile being delivered 5 miles charges for the entire 5 mile distance, credit for free mile isn't included. But I guess that's getting a little nit-picky anyway.

4 Aug 2016, 7:37 PM
#22
jeffwebb avatar

jeffwebb

New Zenner

Join Date:
Jul 2005
Location:
Tennessee, USA
Posts:
11
Plugin Contributions:
0

Re: Mileage based shipping module?

jeffwebb:

Just uploaded v1.5

Oops! I got the version number wrong, forgot to include GPL license, and needed some improvements in the documentation. Got in a hurry I guess. Re-submitted with corrections. Hope the Admins will accept sincere apologies!

20 Mar 2017, 12:55 AM
#23
spacemonkey avatar

spacemonkey

Zen Follower

Join Date:
Nov 2013
Location:
Dorset, UK
Posts:
124
Plugin Contributions:
0

Re: Mileage based shipping module?

Hi All.

I am looking at trying to modify this plugin to work as a local delivery module. The Google lookup works lovely and very accurate, in fact to accurate and that's the problem.

My task is to charge in tier groups, example below.

Up to 3 miles = Free

3 but <5 miles = £2.00
5 but <7 miles = £5.00
7 = No Delivery Available

Anyone got any ideas?

30 Aug 2017, 2:56 PM
#24
fjolsvith avatar

fjolsvith

New Zenner

Join Date:
Mar 2016
Location:
Norcatur, Kansas, USA
Posts:
88
Plugin Contributions:
2

Re: Mileage based shipping module?

Hi All.

I am looking at trying to modify this plugin to work as a local delivery module. The Google lookup works lovely and very accurate, in fact to accurate and that's the problem.

My task is to charge in tier groups, example below.

Up to 3 miles = Free

3 but <5 miles = £2.00
5 but <7 miles = £5.00
7 = No Delivery Available

Anyone got any ideas?

Hi, I wrote the original module.

You will need to go into the code and modify it to reflect your tiers, is all. Take for instance, the code from the /includes/modules/shipping/mileageship.php file starting line 50:

if (MODULE_SHIPPING_MILEAGESHIP_FREEMILES > 0) {
                $cost_miles = $info['distance'] - MODULE_SHIPPING_MILEAGESHIP_FREEMILES ;
	      }
          else {
		    $cost_miles = $info['distance'];
	      }

Then modify it to have an ElseIf section for each distance you wish to categorize:

if (MODULE_SHIPPING_MILEAGESHIP_FREEMILES > 0) {
                $cost_miles = $info['distance'] - MODULE_SHIPPING_MILEAGESHIP_FREEMILES ;
	      }
          else {
		    if ($info['distance'] < 3) {
		        $cost_miles = 0;
		    } elseif ($info['distance'] < 5) {
		        $cost_miles = 2;
		    } elseif ($info['distance'] < 7) {
		        $cost_miles = 5;
		    } else {
		        $shipping_cost = 0;
		        $error = true;
		    }
	      }

Good Luck!

Fjolsvith

1 Nov 2017, 1:28 PM
#25
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Mileage based shipping module?

Hi Is this module still being updated? The reason I ask is because we are offering an installation and delivery service and think this would be useful

Also could this work for UK?

please let me know

Debbie Harrison
DVH Design | Web Design blog

7 Nov 2017, 4:58 PM
#26
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Mileage based shipping module?

Ok I have got this working on our current website 1.5.5e. However is there a way that we can enable this shipping for one category only?

For example we have desks which are fully assembled and delivered from our distribution centre in Yorkshire, which is the section we need the mileage shipping option for. With every other product delivery is free.

Please advise.

Debbie Harrison
DVH Design | Web Design blog

3 Mar 2018, 2:08 PM
#27
fjolsvith avatar

fjolsvith

New Zenner

Join Date:
Mar 2016
Location:
Norcatur, Kansas, USA
Posts:
88
Plugin Contributions:
2

Re: Mileage based shipping module?

Hi,

Shipping modules are typically global with respect to products. To specify free shipping for a product, you would need to do that for each product in its catalog listing. Just don't specify free shipping for the products you have in the one category.

Good Luck!

3 Mar 2018, 3:25 PM
#28
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Mileage based shipping module?

dharrison:

Ok I have got this working on our current website 1.5.5e. However is there a way that we can enable this shipping for one category only?

For example we have desks which are fully assembled and delivered from our distribution centre in Yorkshire, which is the section we need the mileage shipping option for. With every other product delivery is free.

Please advise.

You can code a filter/switch into the shopping cart pages anywhere you find the shipping module lookup - it would simply post true or false based on the products in the cart.

  • It sees a regular product or category - shipping remains free - move on.

  • It sees a mileage product or category - mileage shipping module is added - move on.

On page refresh or if the customer added mixed products to the cart it would default to 'true' or 'add' the mileage shipping module.

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

1 Dec 2018, 12:29 AM
#29
mystery_1 avatar

mystery_1

New Zenner

Join Date:
Jan 2018
Location:
PA
Posts:
14
Plugin Contributions:
0

Re: Mileage based shipping module?

Any chance this can be updated to include the API Key parameters now required by Google to use it. I signed up for and have a key but I cant seem to add the key to the milageship.php in a way that google accepts it.
I was trying to do something like ```html
'https://maps.googleapis.com/maps/api/directions/xml?origin='.$start.'&destination='.$finish.'&sensor=false'.'key=YOUR_API_KEY';

1 Dec 2018, 12:40 AM
#30
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Mileage based shipping module?

Mind adding the link to the plugin/module?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

1 Dec 2018, 12:42 AM
#31
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Mileage based shipping module?

Even with that said, before the parameter of key, need to add an ampersand (&). If the use of the parameter of key is correct for their use.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

1 Dec 2018, 5:11 AM
#32
mystery_1 avatar

mystery_1

New Zenner

Join Date:
Jan 2018
Location:
PA
Posts:
14
Plugin Contributions:
0

Re: Mileage based shipping module?

Hi
The download link for the plugin can be found here

https://www.zen-cart.com/downloads.php?do=file&id=2070&uid=6053&act=down&actionhash=guest

I'm trying to get this to work looking at the Google Maps Platform Developers Guide located here:

https://developers.google.com/maps/documentation/directions/intro

I see your advice about adding an ampersand (&) but even adding it, I still cannot get it working. I'm adding it to the end like the guide shows.

1 Dec 2018, 5:42 AM
#33
mystery_1 avatar

mystery_1

New Zenner

Join Date:
Jan 2018
Location:
PA
Posts:
14
Plugin Contributions:
0

Re: Mileage based shipping module?

I got it now. For anyone else that wants this to work the coding on line 153 of mileageship.php needs to be changed to:

$url = 'https://maps.googleapis.com/maps/api/directions/xml?origin='.$start.'&destination='.$finish.'&sensor=false'.'&key=YOUR_API_KEY';

and you cannot set a referer restriction for your API key via Google.