Price displayed based on proximity

Is there a way to modify the "Proximity search with results sorted by distance"  Example Code to display a different price based on proximity using default values and not using a search form?

The idea would  be to set the fromAddress default value of zip code (for example:63841) as Point A and use a User Account zip code as Point B. If distance between Point A to Point B is greater than 50 miles away it displays Price 1, if greater than 25miles it displays Price 2, If less than 25 miles it displays Price 3.

Dan Perez

By Dave - December 12, 2013

Hi Dan, 

Yes, using the "sample_search.php" example code referred to as "Proximity search with results sorted by distance" you could just do this:

<?php 
  if     (!$record['_distance'])     { print "Unknown, can't calculate distance!"; } 
  elseif ($record['_distance'] > 50) { print $record['price1']; }
  elseif ($record['_distance'] > 25) { print $record['price2']; }
  else                               { print $record['price3']; }
?>

Let me know if that will work for you.

Dave Edis - Senior Developer
interactivetools.com

By Dave - December 12, 2013

Hi Dan, 

Basically it would be exactly the same as a proximity search but instead of having the user enter a zipcode you'd use their lng/lat coordinates from their user profile, and you'd need those for all the products too.  There's probably a few steps involved.  If you've got a proximity form setup already, and are automatically geocoding users addresses, and users are logged in, and products are all geocoded already, it shouldn't take too much more.

If you've already sent a ticket in (with FTP/CMS details?) I'll ask Ross to take a look and follow up either directly or through this post.

Talk soon, cheers!

Dave Edis - Senior Developer
interactivetools.com

By ross - December 13, 2013

Hi Dan

Just a quick heads up to let you know I got your email and replied to it yesterday. We can continue the discussion through email. If you don't see my reply though, could you let me know here?

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/