Created
August 16, 2012 22:14
-
-
Save jasonvarga/3374103 to your computer and use it in GitHub Desktop.
Retailer index page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{embed="_inc/_wrapper" body_class="retailer-locator"} | |
{exp:stash:set} | |
{stash:meta} | |
<title>Retailer Locator | {site_name}</title> | |
{/stash:meta} | |
{stash:content} | |
<div class="split clearfix"> | |
<div class="split-1"> | |
<header> | |
<h1>Retailer Locator</h1> | |
<h2>{var_retailers_subheading}</h2> | |
</header> | |
{exp:low_variables:single var="var_retailers_intro" format="xhtml"} | |
{exp:stash:get name="search_form"} | |
{exp:low_variables:single var="var_retailers_content"} | |
</div> | |
<div class="split-2"> | |
{exp:stash:get name="search_results"} | |
</div> | |
</div> | |
{/stash:content} | |
{stash:search_form} | |
{exp:gmap:search | |
channel="retailers" | |
cache_post="true" | |
class="form"} | |
<div> | |
<label for="state">State</label> | |
<select name="retailer_state" id="state"> | |
<option value="">Select a state</option> | |
<option id="USA-AL" value="AL" {if "{post:retailer_state}" == "AL"}selected{/if}>Alabama (AL)</option> | |
</select> | |
</div> | |
<div> | |
<label for="state">Zip</label> | |
<input type="text" name="retailer_zip_like" placeholder="or enter a zip code..." value="{post:retailer_zip_like}" /> | |
</div> | |
<div> | |
<label for="categories">What are you looking for?</label> | |
<select name="categories[]" id="categories"> | |
<option value="">What are you looking for?</option> | |
{categories} | |
<option value="{category_id}" {selected}>{if category_description}{category_description}{if:else}{category_name}{/if}</option> | |
{/categories} | |
</select> | |
</div> | |
<div class="actions"> | |
<input type="submit" value="Submit" class="button button-alt" /> | |
</div> | |
{/exp:gmap:search} | |
{/stash:search_form} | |
{/exp:stash:set} | |
{preload_replace:limit="10"} | |
{exp:gmap:results | |
limit="{limit}" | |
order_by="title" | |
cache_post="true" | |
paginate="true" | |
parse="inward"} | |
{exp:ifelse parse="inward"} | |
{if has_searched} | |
{exp:stash:set name="search_results"} | |
<section class="search-results"> | |
<h2>Search Results <small>Maximum of {limit} results shown</small></h2> | |
<table class="data"> | |
<thead> | |
<tr> | |
<th>Retailer</th> | |
<th>Address</th> | |
</tr> | |
</thead> | |
<tbody> | |
{results} | |
<tr> | |
<td><a href="{path='retailers'}/{url_title}">{title}</a></td> | |
<td> | |
{retailer_address}, | |
{retailer_city} {retailer_state} {retailer_zip} | |
</td> | |
</tr> | |
{/results} | |
</tbody> | |
</table> | |
</section> | |
<p> | |
<span>Showing Page {current_page} of {total_pages}</span> | |
{if prev_page}<a href="/retailers/page/{prev_page}">← Prev Page</a>{/if} | |
{if next_page}<a href="/retailers/page/{next_page}">Next Page →</a>{/if} | |
</p> | |
{/exp:stash:set} | |
{if:else} | |
{!-- Haven't performed a search yet --} | |
{exp:stash:set name="search_results"} | |
<h3 style="padding-top:35px;">Perform a search to begin</h3> | |
<p> | |
Perform a search for a retailer by selecting a state or entering a zip code.<br /> | |
Additionally, if you are looking for a particular wine, select it from the dropdown. | |
</p> | |
{/exp:stash:set} | |
{/if} | |
{if no_results} | |
{exp:stash:set name="search_results"} | |
<section class="search-results"> | |
<h2>Search Results</h2> | |
<h3>Your search returned no results.</h3> | |
<p>You could try to select either a state, zip or wine.</p> | |
</section> | |
{/exp:stash:set} | |
{/if} | |
{/exp:ifelse} | |
{/exp:gmap:results} |
What happens if you remove the limit parameter?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If it's not obvious, the {stash:content} pair is what gets thrown into my embed at the top.