Page 1 of 1

Only show brands with visible products

Posted: Thu Feb 21, 2013 5:04 pm
by Tony Barnes
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:

Code: Select all

$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]brands ORDER BY brandname ASC");
Change to:

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");
Your brands page will now only display brands which have at least 1 visible product in them :D

Re: Only show brands with visible products

Posted: Wed Mar 06, 2013 12:32 am
by CharlieFoxtrot
Good catch! Great fix! -- I'll have to tinker with this query a little bit... it's not working with ISC 4.07.

Re: Only show brands with visible products

Posted: Tue Mar 26, 2013 10:05 am
by Tony Barnes
Cheers - just odd that they would show - well, not that odd given planning standards at Interspire I guess...