From fd61728da5daac4a21cc73783e661e1266db92f7 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 17 Jun 2019 23:29:48 -0400 Subject: [PATCH] moved vendors away from datatables to server side listing --- products.php | 1 + vendors.php | 77 ++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/products.php b/products.php index 21285aab..7238da2d 100644 --- a/products.php +++ b/products.php @@ -62,6 +62,7 @@ +
diff --git a/vendors.php b/vendors.php index 13491d5d..4cc3bd21 100644 --- a/vendors.php +++ b/vendors.php @@ -1,22 +1,78 @@ - + + $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o))); + + if(isset($_GET['p'])){ + $p = intval($_GET['p']); + $record_from = (($p)-1)*10; + $record_to = 10; + }else{ + $record_from = 0; + $record_to = 10; + $p = 1; + } + + if(isset($_GET['q'])){ + $q = $_GET['q']; + }else{ + $q = ""; + } + + if(!empty($_GET['sb'])){ + $sb = $_GET['sb']; + }else{ + $sb = "vendor_name"; + } + + if(isset($_GET['o'])){ + if($_GET['o'] == 'ASC'){ + $o = "ASC"; + $disp = "DESC"; + }else{ + $o = "DESC"; + $disp = "ASC"; + } + }else{ + $o = "DESC"; + $disp = "ASC"; + } + + $sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM vendors WHERE client_id = 0 + AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%') + ORDER BY $sb $o LIMIT $record_from, $record_to"); + + $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); + $total_found_rows = $num_rows[0]; + $total_pages = ceil($total_found_rows / 10); + + ?>
-
+
Vendors
+
+
+ +
+ +
+
+ +
-
- +
+ - - - - + + + + @@ -66,6 +122,9 @@
VendorDescriptionAccount NumberActionsVendorDescriptionAccount NumberAction
+ + +