Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created September 22, 2013 13:31
Show Gist options
  • Select an option

  • Save objectivehtml/6659928 to your computer and use it in GitHub Desktop.

Select an option

Save objectivehtml/6659928 to your computer and use it in GitHub Desktop.
{exp:gmap:search
channel="truck"
return="/find-trucks"
geocode_field="current_location"
distance_field="distance_max"
latitude_field="latitude-truck"
longitude_field="longitude-truck"
cache_post="false"
}
<div id="user_form">
<h3>Find Trucks</h3>
<p>Use the form below to search for trucks.</p>
<div class="form_find_outer">
<div class="section3">Search:</div>
<div class="light_row_map last_outline">
<div class="map-form">
<div class="find_form_element" style="width:213px;">
Current address, city & state, or zipcode:
<input type="text" name="current_location" value="{current_location}" class="user_field" style="width:213px;margin-top:3px;" maxlength="100" />
</div>
<div class="find_form_element" style="width:215px">
Distance from current location:<br />
<select name="distance_max" id="distance" style="width:215px;margin-top:3px;">
<option value="50" {if distance_max == "50"}selected="selected"{/if}>50 miles</option>
<option value="100" {if distance_max == "100"}selected="selected"{/if}>100 miles</option>
<option value="150" {if distance_max == "150"}selected="selected"{/if}>150 miles</option>
<option value="200" {if distance_max == "200"}selected="selected"{/if}>200 miles</option>
<option value="250" {if distance_max == "250"}selected="selected"{/if}>250 miles</option>
</select>
</div>
<div class="find_form_element" style="width:100px">
Truck Type:<br>
<select name="equipment-truck" style="width:100px;margin-top:3px;">
<option value="" {if equipment-truck ==""}selected="selected"{/if}>Show All</option>
{options:equipment-truck}
<option value="{option_value}" {selected}>{option_name}</option>
{/options:equipment-truck}
</select>
</div>
<div class="find_form_element" style="width:100px">
Truck Options:<br>
<select name="options-truck_like" style="width:100px;margin-top:3px;">
<option value="" {if options-truck_like ==""}selected="selected"{/if}>Show All</option>
<option value="hazmat" {if options-truck_like =="hazmat"}selected="selected"{/if}>Hazmat</option>
<option value="palletexchange" {if options-truck_like =="palletexchange"}selected="selected"{/if}>Pallet Exchange</option>
<option value="side" {if options-truck_like =="side"}selected="selected"{/if}>Side</option>
<option value="tarps" {if options-truck_like =="tarps"}selected="selected"{/if}>Tarps</option>
<option value="removablegooseneck" {if options-truck_like =="removablegooseneck"}selected="selected"{/if}>Removable Gooseneck</option>
<option value="airride" {if options-truck_like =="airride"}selected="selected"{/if}>Air-Ride</option>
<option value="vented" {if options-truck_like =="vented"}selected="selected"{/if}>Vented</option>
<option value="curtains" {if options-truck_like =="curtains"}selected="selected"{/if}>Curtains</option>
<option value="btrain" {if options-truck_like =="btrain"}selected="selected"{/if}>B-Train</option>
<option value="team" {if options-truck_like =="team"}selected="selected"{/if}>Team</option>
<option value="walkingfloor" {if options-truck_like =="walkingfloor"}selected="selected"{/if}>Walking Floor</option>
<option value="driverunload" {if options-truck_like =="driverunload"}selected="selected"{/if}>Driver Unload</option>
<option value="unloadpaid" {if options-truck_like =="unloadpaid"}selected="selected"{/if}>Unloaded Paid w/ Receipt</option>
</select>
</div>
<div class="find_form_element" style="width:100px">
Date Available:<br>
<select name="origin-date-truck_day" style="width:100px;margin-top:3px;">
{exp:select:day_dropdown total_days="7" post_variable="origin-date-truck_day"}
<option value="{option_value}" {selected}>{option_name}</option>
{/exp:select:day_dropdown}
</select>
</div>
<input type="submit" name="search" value="Search" class="wait" style="margin-top:11px;" />
</div>
<div class="map-find shadow">
{if has_searched}
{exp:gmap:results
parse="inward"
cache_post="false"
limit="100"
paginate="true"
}
{exp:gmap:init id="map_canvas" style="width:640px;height:240px" scrollwheel="false"}
{results}
{if result:total_results == 1}
{exp:gmap:marker
id="map_canvas"
latitude="{result:latitude-truck}"
longitude="{result:longitude-truck}"
icon="{site_url}images/truck.png"
show_one_window="true"
zoom="18"
geocode="false"
}
<div style="overflow:hidden;">
<span style="width:155px; float:left; color:#00467e; font-weight:bold; text-align:left; margin:0; padding:0; font-size:13px;">{result:equipment-truck}</span><br>
<strong>Location:</strong> {result:origin-city-truck}, {result:origin-state-truck}<br>
<strong>Company:</strong> {result:company-truck}<br>
<strong>Contact:</strong> {result:contact-phone-truck}
</div>
{/exp:gmap:marker}
{if:else}
{exp:gmap:marker
id="map_canvas"
latitude="{result:latitude-truck}"
longitude="{result:longitude-truck}"
geocode="false"
icon="{site_url}images/truck.png"
show_one_window="true"
clustering="true"
}
<div style="overflow:hidden;">
<span style="width:155px; float:left; color:#00467e; font-weight:bold; text-align:left; margin:0; padding:0; font-size:13px;">{result:equipment-truck}</span><br>
<strong>Location:</strong> {result:origin-city-truck}, {result:origin-state-truck}<br>
<strong>Company:</strong> {result:company-truck}<br>
<strong>Contact:</strong> {result:contact-phone-truck}
</div>
{/exp:gmap:marker}
{/if}
{/results}
</div>
</div>
</div>
</div>
<div id="grid">
{if current_location != ""}<h4 style="width:auto;">Available Trucks {distance_max} {metric} from <em>{formatted_address}:</em></h4>{if:else}<h4 style="width:auto;">Recent Matching Trucks:</h4>{/if}
<p style="margin:1em 0 0;width:400px;padding:0;float:right;text-align:right">
<span style="display:inline-block;margin:1em 2em 1em 0">Showing Page {current_page} of {total_pages}</span>
{if prev_page}<a href="/find-loads/page/{prev_page}" style="padding:.5em;">&larr; Prev Page</a>{/if}
{if next_page}<a href="/find-loads/page/{next_page}" style="padding:.5em;">Next Page &rarr;</a>{/if}
</p>
</div>
{/exp:gmap:results}
{/if}
{if has_not_searched}
{embed="embeds/no-trucks-found"}
{/if}
{/exp:gmap:search}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment