diff --git a/products.php b/products.php index f8cd081e..c6bf601e 100644 --- a/products.php +++ b/products.php @@ -6,17 +6,29 @@ $order = "ASC"; require_once "inc_all.php"; +// Category Filter +if (isset($_GET['category']) & !empty($_GET['category'])) { + $category_query = 'AND (category_id = ' . intval($_GET['category']) . ')'; + $category = intval($_GET['category']); +} else { + // Default - any + $category_query = ''; + $category = ''; +} //Rebuild URL -$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'o' => $order))); +$url_query_strings_sort = http_build_query($get_copy); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM products LEFT JOIN categories ON product_category_id = category_id LEFT JOIN taxes ON product_tax_id = tax_id - WHERE product_archived_at IS NULL - AND (product_name LIKE '%$q%' OR product_description LIKE '%$q%' OR category_name LIKE '%$q%' OR product_price LIKE '%$q%' OR tax_name LIKE '%$q%' OR tax_percent LIKE '%$q%') + WHERE (product_name LIKE '%$q%' OR product_description LIKE '%$q%' OR category_name LIKE '%$q%' OR product_price LIKE '%$q%' OR tax_name LIKE '%$q%' OR tax_percent LIKE '%$q%') + AND product_$archive_query + $category_query + + ORDER BY $sort $order LIMIT $record_from, $record_to" ); @@ -28,12 +40,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));

Products

- +
+ + + +
+
@@ -43,6 +64,56 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+
+
+ +
+
+
+
+ "> + Archived + + +
+