Community Add-Ons
All Customers Report
for osCommerce Online Merchant v2.2
All Customers Report v1.0 - March 22, 2005
written by Jared Call at client's suggestion
some code nicked and modified from /catalog/admin/customers.php
Released under the GNU General Public License
What this contrib does:
=========================
This contribution simply generates a list of all customers and their mailing addresses, alphabetized by last name (surname). Depending on several things, it may take several seconds to generate. The resulting data can be easily copied/pasted into spreadsheets for mailing list labels, importing into other customer management software, etc.
Disclaimer: This contrib has been designed for and tested with osCommerce 2.2 MS2. While it should easily work, perhaps with minor modifications, with other versions of osCommerce, it has not been tested as such.
If you find this contribution useful, please support the osCommerce project by becoming an osCommerce Community Sponsor. At the time of this writing, details of Community Sponsorship can be found at http://www.oscommerce.com/about/news,111 .
We had some problems with the original JOINs in the query in MySQL 5 so below is an updated SQL statement to replace the one around line 117 which does the same, but works on all MySQL versions we tested.
Regards
$customers_query_raw = "SELECT c.customers_id , c.customers_default_address_id, c.customers_email_address, c.customers_dob, c.customers_telephone, c.customers_gender, c.hear, a.entry_company, a.address_book_id, a.customers_id, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_suburb, a.entry_city, a.entry_state, a.entry_postcode, a.entry_country_id, a.entry_zone_id, z.zone_code, co.countries_name FROM " . TABLE_CUSTOMERS . " c LEFT JOIN " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id JOIN " . TABLE_COUNTRIES . " co ON a.entry_country_id = co.countries_id LEFT JOIN " . TABLE_ZONES . " z ON a.entry_zone_id = z.zone_id ORDER BY $db_orderby $sorted";
