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

Thanks Dave.  Where would I enter the default zip as point A and the user zip as point B. I submitted this also through the hire us portion incase it requires development costs.  Haven't heard back yet.

Dan Perez

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/