Binders: products

TODO:

 

/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     function.bind.php
 * Type:     function
 * Name:     bind
 * Purpose:  includes template content
 * -------------------------------------------------------------
 *
 * @param {array} $params 
 *                  $params['show'] What to show (e.g. categories, tags, featured, category) 
 *                  $params['hide_empty'] Hides empty categories when showing a list of categories. Possible values are 0 or 1
 *                  $params['assign_to'] Variable within the template engine to which the content has to be assigned.
 *
 * 
 * # EXAMPLE
 * 
 * 
 * 
 * @example
 * 
 * # EXAMPLE 1: show products in the specified category
 * {products cat_slug="featured-items" size="3" assign_to="featured"}
 * 
 * 
 * # EXAMPLE 2: shows a list of product categories
 * {products show="categories" assign_to="categories"}
 * 
 * <h3 class="sidebar-title">Product Categories </h3>
 * <ul class="product-categories">
 * 	    {foreach $categories.data as $cat}
 * 	        <li class="cat-item cat-item-{$cat.term_id}">
 * 	            <a href="{$cat.permalink}">{$cat.name} ({$cat.count})</a>
 * 	        </li>
 * 	    {/foreach}
 * </ul>
 * 
 * 
 * #EXAMPLE 3
 * {products show="featured" assign_to="featured_products"}
 * 
 * 
 * # EXAMPLE 4: Get a list of all available product tags
 * 
 * {{products show="tags" assign_to="tags"}}
 * 
 *
 * 
 * # EXAMPLE 5: show products in the specified tag
 * 
 * {{products tag="my-tag" size="4" assign_to="products_by_tag"}}
 *
 * <h3>Product By Tag: My Tag </h3>
 * <ul class="product-categories">
 * 	    {{foreach $products_by_tag.data as $product}}
 * 	        <li class="item">
 * 	            <a href="{$product.permalink}">{{$product.post_title}}</a>
 * 	        </li>
 * 	    {{/foreach}}
 * </ul>
 * 
 *
 * 
 * #EXAMPLE 6: shows current category name
 * {products show="category" assign_to="current_cat"}
 * 
 * <h1>Category: {$current_cat}</h1>
 *
 */

 

Leave a Reply

Your email address will not be published. Required fields are marked *