Save Exports
-
This obviously could be enhanced on, but I added the ability to store the exports and display a list of previous exports on the page. Just had someone request this and thought it could be added in…
First I commented out “unlink($filename);” in order-export.php
Next I created a directory in the uploads directory called “order-exports” and modified the fopen statements to include the folder in the path.
Finally I added the following in order-export.php after the “Export Orders” button:<?php $upload_dir = wp_upload_dir(); $dir = $upload_dir['basedir'].'/order-exports'; $dh = opendir($dir); $selected = "<h1>Here are the Exports</h1>"; // $selected .= '<h1>'. $con_entry_id . '</h1>'; while (false !== ($filename = readdir($dh))) { $files[] = $filename; if ($filename == '.' || $filename == '..') { continue; } $selected .= '<a href="'.$upload_dir['baseurl'].'/order-exports/'.$filename.'">'.$filename.'</a><br/>'; $selected .= "<script>jQuery('.wpg-order-export').click( function(){ window.setTimeout(function(){location.reload()},3000) });</script>"; } echo $selected; ?>https://ww.wp.xz.cn/plugins/woocommerce-simply-order-export/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Save Exports’ is closed to new replies.