include_once("header.html");
$product = new Product();
// This statement says "if you're trying to filter by brand, use searchProductByBrand, otherwise, get all products (getProducts)"
if ($_GET['by-brand'] != null && $_GET['by-brand'] != "" && $_GET['by-brand'] != "ALL") {
$productArr = $product->searchProductByBrand($_GET['by-brand']);
}
else {
$productArr = $product->getProducts();
}
$count = $productArr['count'][0];
$countPerColumn = ceil($count/2);
$columnCount = 0;
$columnAmount = 1;
$index = 0;
?>
Welcome Cigar Aficionados
Cigar List
$alphabet = array(1 => "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "ALL");
foreach($alphabet as $key => $letter) {
print "" . $letter . "";
}
?>
if ($count == 0) {
print "No results found for letter " . $_GET['by-brand'] . ".
| ";
}
$brindex = 0;
foreach($productArr as $brand => $arr) {
//The next 3 lines put a space above the Brand
if ($brindex != 0) {
print " ";
}
if($brand == 'count') {
continue;
}
print " | " . $brand . "
| ";
/* print " | " . $brand . "
| "; */
$brindex++;
$columnCount++;
?>
foreach($arr as $key => $productObj) {
if ($columnCount >= $countPerColumn && $columnAmount < 2) {
?>
|
|
|
|
$columnAmount++;
$columnCount = 0;
}
$columnCount++;
?>
// NJS-- load the review count Daga, is this neccessary? Maybe the getReviewCount can be pulled in a function above or inside of getProducts?
$reviewCount = $productObj->number_of_reviews;
?>
}
}
?>
|
|
include_once("footer.html");
?>