Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hi, I have recently downloaded and installed the contribution ?Newsletter Email Address Exporter? which can be found here http://www.oscommerce.com/community/contributions,3116/

 

It works fine, however I need to also export the customer?s full street address.

 

Can someone please point me in the right direction please?

 

 

 

HERE IS THE CODE

 

<?php 
######## TAB-DELIMITED TEXT FILE EXPORTER FOR EXTERNAL MAIL LIST IMPORT
# Should work for most all osC versions, used on MS2.2 and earlier
# By Richard Bartz,  [email protected]
# HOW TO INSTALL 
# This little script is just to export all of the email addresses from your osC
# customer database who have subscribed to your newsletter to a tab delimited file
# that can be imported into a better mailer such as phpList.
#
# 1. Change the $filename variable to whatever file name you want. 
# 2. upload this file in the osC admin directory
# 3. in admin/includes/boxes/tools.php add:  tep_admin_files_boxes('email_export.php', 'Email Export') .
#	or on OLD veraions add 
#	'<a href="' . tep_href_link('email_export.php', '', 'NONSSL') . '" class="menuBoxContentLink" target="_blank">Email Export</a><br>'.
# 4. That's it!  Click on "Email Export" in Admin->Tools!  Save and import.
# 5. Security:  If you use .htaccess in admin you are safe.
#	If you use admin add-ons then requiring the application_top.php should do it.
#	In either case the file should NOT run from a direct call.
########

$filename="addresses.txt";  //.txt is good for import into excel workbook as tab delimited file

// end of configuration!
require('includes/application_top.php');  // gives us SOME security anyway
require_once('includes/configure.php');  // gives us osC database info

header('Content-Type: text/x-csv');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

if ( mysql_connect ( DB_SERVER , DB_SERVER_USERNAME , DB_SERVER_PASSWORD )) { 
$sql   = "SELECT  customers_firstname, customers_lastname, customers_email_address "; 
$sql .= "FROM customers WHERE customers_newsletter = '1'"; 
$result = mysql_db_query ( DB_DATABASE , $sql );
echo "email\tFirst Name\tLast Name\n";
while ( $row = mysql_fetch_array($result)) {
	if ($row[customers_email_address]) {
		echo "$row[customers_email_address]\t$row[customers_firstname]\t$row[customers_lastname]\n";
	}

} 
} 
mysql_close (); 
?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...