Hi Jeremy,
Having a bit of a rough time with all this :)
I've been looking at the function below like you said. What I have now is the 'FeaturedProduct' option activated in the sort menu (Sort by Alphabetical Lowest Price Most Popular Featured)
When I click on 'Featured' it sorts the products featured first followed by non featured.
If when I click on'Featured' I could get it to ONLY show featured products then I think I'd be well on my way to getting this solved.
Of course the reason I'm here is I haven't been able to do that myself. Do you know what I'd need to do to make that happen?
function ProductsShowable($extraFilter = '', $recursive = true){
$filter = ""; //
$join = "";
$this->extend('updateFilter',$extraFilter);
if($extraFilter) $filter.= " AND $extraFilter";
if(self::$must_have_price) $filter .= " AND \"Price\" > 0";
$limit = (isset($_GET['start']) && (int)$_GET['start'] > 0) ? (int)$_GET['start'].",".self::$page_length : "0,".self::$page_length;
$sort = (isset($_GET['sortby'])) ? Convert::raw2sql($_GET['sortby']) : "\"FeaturedProduct\" DESC,\"Title\"";
//hard coded sort configuration //TODO: make these custom
if($sort == "NumberSold") $sort .= " DESC";
$groupids = array($this->ID);
if(($recursive === true || $recursive === 'true') && self::$include_child_groups && $childgroups = $this->ChildGroups(true))
$groupids = array_merge($groupids,$childgroups->map('ID','ID'));
$groupidsimpl = implode(',',$groupids);
$join = $this->getManyManyJoin('Products','Product');
$multicatfilter = $this->getManyManyFilter('Products','Product');
//TODO: get products that appear in child groups (make this optional)
$products = DataObject::get('Product',"(\"ParentID\" IN ($groupidsimpl) OR $multicatfilter) $filter",$sort,$join,$limit);
$allproducts = DataObject::get('Product',"\"ParentID\" IN ($groupidsimpl) $filter","",$join);
if($allproducts) $products->TotalCount = $allproducts->Count(); //add total count to returned data for 'showing x to y of z products'
if($products && $products instanceof DataObjectSet) $products->removeDuplicates();
return $products;
}