Snippet: Template logic to fetch recently updated products
Question
How to fetch all objects of class 'product' recently published with object result limit of 3
Answer
Template file, ' design/example/templates/toolbar/full/box_latest_products.tpl'
{def $products=fetch('content', 'list', hash( 'parent_node_id', 61, 'sort_by', array( 'published', false() ), 'limit', 3, 'class_filter_type', 'include', 'class_filter_array', array( 'product' ), 'depth', 3)) } <h2>Latest Products</h2> <ul> {foreach $products as $product} {* $product.object|attribute(show,1) *} <li><a href={$product.url_alias|ezurl}>{$product.name}</a><br />{$product.object.modified|datetime('custom', '%m/%d/%Y @ %G:%i')}</li> {* {$product.count} *} {/foreach} </ul> {undef}