Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created June 18, 2012 16:53
Show Gist options
  • Save objectivehtml/2949384 to your computer and use it in GitHub Desktop.
Save objectivehtml/2949384 to your computer and use it in GitHub Desktop.
Simple Stash Embed Usage
{exp:stash:set type="snippet"}
{stash:search_header}
<input type="hidden" name="current_page" value="{current_page}" />
<input type="hidden" name="total_pages" value="{total_pages}" />
<section class="clear products grid">
<div class="sort orange row">
<p class="totals float-left">{total_results} Products ({total_pages} Page{if total_pages > 0}s{/if})</p>
<form class="clearfix float-left">
<p class="margin-right">
<label for="order_by">Order By</label>
<select name="order" id="order_by">
<option value="product_brand">Brand</option>
<option value="product_display_price">Price</option>
</select>
</p>
<p class="">
<label for="sort">Sort</label>
<select name="sort" id="sort">
<option value="asc">ASC</option>
<option value="desc">DESC</option>
</select>
</p>
</form>
</div>
<div class="search-results">
<h6>Page {current_page}</h6>
{/stash:search_header}
{stash:search_footer}
</div>
<a href="#" class="more nice brown button">Next Page <span></span></a>
</section>
{/stash:search_footer}
{/exp:stash:set}
{stash:embed name="store:products" replace="yes"}
<article class="product clearfix">
<div class="wrapper">
<a href="/details/{url_title}">
<header>
<h4>{product_brand} - {product_filter_type}</h4>
<h5>{product_height}" <span class ="times">&times</span> {product_width}" <span class="times">&times</span> {product_depth}"</h5>
<span class="more"></span>
</header>
<img src="{if product_front_photo}{product_front_photo}{if:else}http://www.placehold.it/300x300{/if}" alt="Product Name" />
</a>
<section class="actions">
<a href="#compare" class="float-left"><span class="plus">+</span>Compare</a>
<a href="/add/{entry_id}" class="float-right">Add<span class="plus">+</span></a>
</section>
</div>
</article>
{exp:data:entries
channel="products"
sort="{sort}"
order_by="{order_by}"
limit="{limit}"
offset="{offset}"
page="{page}"
}
{if is_first_row}
{if search_header}{search_header}{/if}
<ul>
{/if}
<li>
{stash:embed name="store:product" process="start"}
</li>
{if is_last_row}
</ul>
{if search_footer}{search_footer}{/if}
{/if}
{/exp:data:entries}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment