diff --git a/agent/modals/product/product_import.php b/agent/modals/product/product_import.php new file mode 100644 index 00000000..f390c2bf --- /dev/null +++ b/agent/modals/product/product_import.php @@ -0,0 +1,32 @@ + + +
+ + + +
+ +$row_count Product(s) added"); + + redirect(); + + } + + //Check for any errors, if there are notify user and redirect + if ($error) { + redirect(); + } +} + +if (isset($_GET['download_products_csv_template'])) { + + $delimiter = ","; + $enclosure = '"'; + $escape = '\\'; // backsla + $filename = "Products-Template.csv"; + + //create a file pointer + $f = fopen('php://memory', 'w'); + + //set column headers + $fields = array('Product Name', 'Description', 'Price'); + fputcsv($f, $fields, $delimiter, $enclosure, $escape); + + //move back to beginning of file + fseek($f, 0); + + //set headers to download file rather than displayed + header('Content-Type: text/csv'); + header('Content-Disposition: attachment; filename="' . $filename . '";'); + + //output all remaining data on a file pointer + fpassthru($f); + + exit; + +} diff --git a/agent/products.php b/agent/products.php index 8c8ee205..c540fdb5 100644 --- a/agent/products.php +++ b/agent/products.php @@ -69,6 +69,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));