<?php require_once("app/Mage.php"); Mage::app(); Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID); $collection = Mage::getModel('customer/customer') ->getCollection() ->addAttributeToSelect('*'); $fp = fopen('file.csv', 'w'); foreach($collection as $customer) { $customerAddressId = $customer->getDefaultBilling(); if ($customerAddressId){ $address = Mage::getModel('customer/address')->load($customerAddressId); $fields = array( $address->getData('company'), $customer->getData('prefix'), $customer->getFirstname(), $customer->getLastname(), $address->getData('street'), $address->getData('postcode'), $address->getData('city'), $address->getCountry(), $customer->getData('email') ); fputcsv($fp, $fields); var_dump($fields); echo "<br>"; } } ?>
I converted the code to html using hilite.me looks nice, what do you think?
Keine Kommentare:
Kommentar veröffentlichen