Popular Products Page
Popular Products Page
Generates a list of the most "popular" products on the site. This is using the top selling as the metric, so the list looks at category "0", all categories, then limits by a small subset (100 as a default using the
limit tag) and sorts by the most sold in descending order.
First, construct this on a copy of the category page - it will use the same basic template with the following tweaks. You will then need to create a content page called "Popular Products" and assign the new cloned template.
At the head of your file, change the
page type variable to use something that isn't
category. This is done to avoid triggering the category options that usually appear in the sidebar include as filters will not work with this tweak.
thumb_list for the product list on this page to have the following parameters
filter_category:'0' to look at your entire inventory,
sortby:'top_sellers' - sort our list by the best selling products up first, &
limit:'100' - a reasonable limit in case the seller has an inventory of thousands of items) :
[%thumb_list type:'products' filter_category:'0' sortby:'top_sellers' limit:'100'%]
Finally, remove this code from the header of that
<div class="col-xs-8 col-sm-5 col-md-4"> <form method="get" class="form-horizontal" action="[@config:CURRENT_URL@]"> <input name="rf" type="hidden" value="[%FILTER_CODE%][%/FILTER_CODE%]"> <div class="form-group"> <label class="control-label col-xs-2">Sort</label> <div class="col-xs-10"> <select name="sortby" onChange="return this.form.submit();" class="form-control"> <option value="popular" [%SORTBY type:'products' if:'eq' value:'popular'%]selected[%/SORTBY%]> Most Popular </option> <option value="name" [%SORTBY type:'products' if:'eq' value:'name'%]selected[%/SORTBY%]> Name </option> <option value="SKU" [%SORTBY type:'products' if:'eq' value:'SKU'%]selected[%/SORTBY%]> SKU </option> <option value="lowest_price" [%SORTBY type:'products' if:'eq' value:'lowest_price'%]selected[%/SORTBY%]> Lowest Price </option> <option value="highest_price" [%SORTBY type:'products' if:'eq' value:'highest_price'%]selected[%/SORTBY%]> Highest Price </option> </select> </div> </div> </form> </div>
If they use this, it won't work because we've hardcoded the param in the
(Optional) Create a link to your new content page in the header
Add the link
headers/template.html and paste the below code directly below
[%menu id:'web_header'%], being sure to replace the
id with the ID of the content page you created in the first step:
[%param *header%] <li><a href="[%url type:'content' id:'11'/%]">Popular Products</a></li> [%/param%]