????
| Current Path : /home2/morganrand/www/ecommerce/os/catalog - Copy/admin/ |
| Current File : /home2/morganrand/www/ecommerce/os/catalog - Copy/admin/customer_export1.php |
<?php
require('includes/application_top.php');
if (!$_POST['submit'])
{
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//DE">
<html <?php echo HTML_PARAMS; ?>>
<head><script src="//cdn.optimizely.com/js/1865631164.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body id="customers">
<!-- header //-->
<?php require(DIR_WS_INCLUDES.'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES.'column_left.php'); ?>
<script>
new Rico.Accordion( $('accordionDiv'), {panelHeight:210, collapsedBg:'#B3BAC5', expandedBg:'#C9C9C9', hoverBg: '#C9C9C9', borderColor:'#C9C9C9', expandedTextColor:'#616060', onLoadShowTab:'5'} );
</script>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_form(BOX_CUSTOMER_EXPORT, FILENAME_CUSTOMER_EXPORT, '', 'post'); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="main"><?php echo TABLE_HEADING_CUSTOMER_EXPORT; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="main"><p>All customer records will be compiled into one CSV (Comma Seperated Value) text file.</p>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent">Firstname</td>
<td class="dataTableHeadingContent">Lastname</td>
<td class="dataTableHeadingContent">Gender</td>
<td class="dataTableHeadingContent">DOB</td>
<td class="dataTableHeadingContent">Company</td>
<td class="dataTableHeadingContent">Address</td>
<td class="dataTableHeadingContent">Zip</td>
<td class="dataTableHeadingContent">City</td>
<td class="dataTableHeadingContent">State</td>
<td class="dataTableHeadingContent">Country</td>
<td class="dataTableHeadingContent">Phone</td>
<td class="dataTableHeadingContent">Email</td>
<td class="dataTableHeadingContent">Fax</td>
</tr>
<tr>
<td class="dataTableContent">John</td>
<td class="dataTableContent">Doe</td>
<td class="dataTableContent">Male</td>
<td class="dataTableContent">1972-05-16</td>
<td class="dataTableContent">Onramp Access, Inc. </td>
<td class="dataTableContent">555 Anystreet </td>
<td class="dataTableContent">55555</td>
<td class="dataTableContent">Austin</td>
<td class="dataTableContent">Texas</td>
<td class="dataTableContent">United Sates </td>
<td class="dataTableContent">555-555-5555</td>
<td class="dataTableContent">johndoe@test.com</td>
<td class="dataTableContent">555-555-5555</td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input type="submit" value="Export" name="submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table></td>
</tr>
</table>
<!-- footer //-->
<center>
<font color="#666666" size="2"></font>
</center>
<!-- footer_eof //-->
<br>
<!-- Hotjar Tracking Code for wanderfuls.com -->
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:78806,hjsv:5};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');
</script></body>
</html>
<?php
}
else
{
$contents="Firstname,Lastname,Gender,DOB,Company,Address,Zip,City,State,Country,Phone,Email,Fax\n";
$user_query = mysql_query('select c.*, adb.*, z.* from customers as c left join address_book as adb on c.customers_id = adb.customers_id left join zones as z on adb.entry_zone_id = z.zone_id');
while($row = mysql_fetch_array($user_query))
{
if ($row[customers_gender]=="m")
{
$gender = "Male";
}
else
{
$gender = "Female";
}
if ($row[entry_country_id] == 81)
{
$land="Deutschland";
}
else
{
$country_query = mysql_query("select countries_name from countries where countries_id = '" . $row[entry_country_id] . "';");
$landq = mysql_fetch_array($country_query);
$land=$landq[countries_name];
}
$contents.=$row[customers_firstname].",";
$contents.=$row[customers_lastname].",";
$contents.=$gender.",";
$contents.=$row[customers_dob].",";
$contents.=$row[entry_company].",";
$contents.=$row[entry_street_address].",";
$contents.=$row[entry_postcode].",";
$contents.=$row[entry_city].",";
$contents.=$row[zone_name].",";
$contents.=$land.",";
$contents.=$row[customers_telephone].",";
$contents.=$row[customers_email_address].",";
$contents.=$row[customers_fax]."\n";
}
Header("Content-Disposition: attachment; filename=export.csv");
print $contents;
}
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>