Only show brands with visible products
Posted: Thu Feb 21, 2013 5:04 pm
Never looked at the Brands page before, just did, and realised it shows brands that have invisible products. That might be useful for some peopel, but no good for us.
Anyway, open /includes/display/BrandProductListing.php, find:
Change to:
Your brands page will now only display brands which have at least 1 visible product in them
Anyway, open /includes/display/BrandProductListing.php, find:
Code: Select all
$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]brands ORDER BY brandname ASC");
Code: Select all
$result = $GLOBALS['ISC_CLASS_DB']->Query(" SELECT brandid,
brandname,
brandpagetitle,
brandmetakeywords,
brandmetadesc,
brandimagefile,
brandsearchkeywords
FROM (SELECT prodname,
Sum(prodvisible) AS total,
prodbrandid
FROM [|PREFIX|]products
GROUP BY prodbrandid) AS checker
JOIN [|PREFIX|]brands b
ON b.brandid = prodbrandid
WHERE total > 0
ORDER BY brandname ASC");