Mittwoch, 12. März 2014

Magento Export Customers

If you need to export customer data for Excel this script does the job. If you upload and execute it. A file.csv with you customers will be created. The UTF-8 CSV file can be imported in Excel. Don't forget to delete both files afterwords. Also note that personal records should not be mailed without encryption.

$collection = Mage::getModel('customer/customer')

$fp = fopen('file.csv', 'w');
foreach($collection as $customer) {
 $customerAddressId = $customer->getDefaultBilling();
    if ($customerAddressId){
        $address = Mage::getModel('customer/address')->load($customerAddressId);

        $fields = array(
        fputcsv($fp, $fields);
        var_dump($fields); echo "<br>";

I converted the code to html using looks nice, what do you think?

Like it? Share it! Flattr this

Keine Kommentare: