Angel2008 Posted May 7, 2008 Posted May 7, 2008 Hello- I am Angel this is my first post in this great forums. I have been looking for a contribution that may help me export some customers data to an excel file, I have come across this one http://addons.oscommerce.com/info/2291 unfortunately it doesn't export exactly what I need. I hope someone of you may be able to let it generate these data: Customer ID, Name, orders ID, Email, and (Date of purchase if possible). Waiting for your kind replies. Angel
Angel2008 Posted May 7, 2008 Author Posted May 7, 2008 Hey again guys, I have made some efforts and I managed to get it done. I modified a contribution. However, I still need your assistance to make it exportable to csv (Excel). Here is the code, it is working just needs the Export function. <?php ob_start(); require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); include(DIR_WS_CLASSES . 'order.php'); $order_status = $select_order_status; $display_order_status = $order_status; if ($order_status == "") { $order_status = 1; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title><?php echo TITLE . ' - ' . OL_TITLE ?></title> <link rel="stylesheet" type="text/css" href="orderlist-styles.css" media="all" > </head> <body> <h1><?php echo OL_HEAD; ?></h1><br> <h2> <?php $query_status = "SELECT * FROM `orders_status` where `orders_status_id` = $order_status AND language_id = $languages_id"; $status_result = tep_db_query($query_status); while ($row4 = tep_db_fetch_array($status_result)) { echo "("; $orders_status_name = $row4['orders_status_name']; echo $orders_status_name; echo ")"; } // FORM THAT LETS YOU SELECT WHICH ORDER STATUS TO DISPLAY ?> </h2> <form name="orderstatus" method="post" action="<?php echo $PHP_SELF?>"> <?php $query_status = "SELECT * FROM `orders_status` WHERE language_id = $languages_id"; $status_result = tep_db_query($query_status); echo OL_SELECT_STATUS . " "; echo "<select name=\"select_order_status\">"; echo "<option value=></option>"; while ($row3 = tep_db_fetch_array($status_result)) { echo "<option value="; echo $row3['orders_status_id']; echo ">"; echo $row3['orders_status_name']; echo "</option><br>"; } echo "</select>"; ?> <input type="submit" name="Submit" value="<?php echo OL_SUBMIT; ?>"> <input type="button" value="<?php echo OL_PRINT; ?>" onClick="window.print()" /> </form> <TABLE width="50%" align=center cellSpacing=1 cellPadding=4 border=1> <TBODY> <TR class="headers"> <TD class="orderNr" align="center"><?php echo OL_ORDERNR; ?></TD> <TD class="customerid" align="center"><?php echo OL_CUSTOMERID; ?></TD> <TD class="date" align="center"><?php echo OL_DATE; ?></TD> <TD class="name"><?php echo OL_NAME; ?></TD> </TR> <?php $query1 = "SELECT * FROM `orders` WHERE orders_status = $order_status ORDER BY orders_id ASC"; $result = tep_db_query($query1); while ($row = tep_db_fetch_array($result)) { $ordernummer = $row['orders_id']; ?> <TR> <TD align="center"> <b><?php echo $ordernummer; ?></b></TD> <TD align="center"> <b><?php echo OL_CUSTOMERID .' '. $row{'customers_id'}; ?></b></TD> <TD align="center"> <?php echo tep_datetime_short($row['date_purchased']); ?></TD> <TD> <?php echo OL_CUSTOMERNAME .' '. $row{'delivery_name'}; ?><br> <?php echo OL_EMAIL .' '. $row{'customers_email_address'}; ?> </TD> </TR> <?php } ?> </table> </body> </html> <?php ob_end_flush(); ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.