<?php
	CLASS ISC_SIDESHOPBYBRANDFULL_PANEL extends PANEL
	{
		public function SetPanelSettings()
		{
			$output = "";
			$a = "SELECT brandid FROM [|PREFIX|]brands WHERE brandimagefile !='' ";
			$num_brands = $GLOBALS['ISC_CLASS_DB']->CountResult($a);

			if($num_brands>5) {
				$query = "select b.brandid, b.brandname, b.brandimagefile, (select count(productid) from [|PREFIX|]products p where p.prodbrandid=b.brandid and p.prodvisible='1') as num from [|PREFIX|]brands b order by b.brandname asc";

				$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

				while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
					$GLOBALS['BrandLink'] = BrandLink($row['brandname']);
					$GLOBALS['BrandName'] = isc_html_escape($row['brandname']);
					$GLOBALS['BrandImage'] = $row['brandimagefile'];
					if($row['brandimagefile'] != ''){
						$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandImage");
					}
				}

				if($num_brands > 5) {
					$GLOBALS['SNIPPETS']['ShopByBrandAllItem'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByBrandAllItem");
				}

				$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
				$GLOBALS['SNIPPETS']['SideShopByBrandFullList'] = $output;
			}
			else {
				$this->DontDisplay = true;
			}
		}
	}