Skip to main content
All CollectionsAPI / Customization / AdvancedPeopleVine HTML API Render Engine (HAPI)
HAPI - Setup a custom page displaying available locations based on the user's location
HAPI - Setup a custom page displaying available locations based on the user's location

This code sample provides a way to automatically sort your locations by the closest distance to the user.

Updated over 3 years ago

You can customize the directory and display locations closest to a user automatically by including a few parameters in a directory-business_locations call.  Simply add the parameters: 

<DIV CLASS="ROW LIST-ITEM" DATA-LOCATION="{@CITY@}"DATA-PV-COMPONENT="DIRECTORY" DATA-PV-TYPE="BUSINESS_LOCATIONS" DATA-PV-PARAMETERS="{RETURNTOTAL: 100, USER_LATITUDE: {@USER_LATITUDE@}, USER_LONGITUDE: {@USER_LONGITUDE@}, SORT_BY: 'DISTANCE'}">          <DIV CLASS="COL-SM-6 PT-4">                 
   <DIV CLASS="WEBAPP_IMAGE_BOX">          
     <IMG SRC="{@COMPANY_LOGO@}" ALT="{@COMPANY_NAME@}"             CLASS="WEBAPP_THUMBNAIL RESPONSIVE MB-2" >                
   </DIV>        
  </DIV>        
   <DIV CLASS="COL-SM-6 TEXT-CENTER PB-4 ITEM-DETAILS">                    <A HREF="/DIRECTORY/{@BUSINESS_NO@}" STYLE="COLOR:#26428B ;">                <H4>{@company_name@}</H4>          
     </A>                  
     <P>{@address1@}, {@city@} {@zip_code@}</P>                
       <P><SPAN STYLE="FONT-WEIGHT:BOLD;">WORK:</SPAN>                         Mon-Fri {@hours_monday@}
       </P>                  
       <P><SPAN STYLE="COLOR:#EC692A;FONT-WEIGHT:BOLD;">CHEW:</SPAN>15% Off Menu</P>                  
<A HREF="/DIRECTORY/{@BUSINESS_NO@}" CLASS="BTN BTN-PRIMARY">View Location Details</A>        
</DIV>
</DIV>


Did this answer your question?