Mage_Customer_Model_Convert_Parser_Customer Class Reference

Inheritance diagram for Mage_Customer_Model_Convert_Parser_Customer:

Mage_Eav_Model_Convert_Parser_Abstract Mage_Dataflow_Model_Convert_Parser_Abstract Mage_Dataflow_Model_Convert_Container_Abstract Mage_Dataflow_Model_Convert_Parser_Interface Mage_Dataflow_Model_Convert_Container_Interface

List of all members.

Public Member Functions

 getFields ()
 getCustomerModel ()
 getCustomerAddressModel ()
 getNewsletterModel ()
 getStore ()
 getStoreId ()
 getStoreById ($storeId)
 getWebsiteById ($websiteId)
 getAttribute ($code)
 getResource ()
 getCollection ($storeId)
 unparse ()
 getExternalAttributes ()
 unparse__OLD ()
 parse ()

Public Attributes

const MULTI_DELIMITER = ' , '

Protected Attributes

 $_resource
 $_collections
 $_customerModel
 $_customerAddressModel
 $_newsletterModel
 $_store
 $_storeId
 $_stores
 $_websites
 $_attributes = array()
 $_fields


Detailed Description

Definition at line 29 of file Customer.php.


Member Function Documentation

getAttribute ( code  ) 

Retrieve eav entity attribute model

Parameters:
string $code
Returns:
Mage_Eav_Model_Entity_Attribute

Definition at line 178 of file Customer.php.

00179     {
00180         if (!isset($this->_attributes[$code])) {
00181             $this->_attributes[$code] = $this->getCustomerModel()->getResource()->getAttribute($code);
00182         }
00183         return $this->_attributes[$code];
00184     }

getCollection ( storeId  ) 

Definition at line 201 of file Customer.php.

00202     {
00203         if (!isset($this->_collections[$storeId])) {
00204             $this->_collections[$storeId] = Mage::getResourceModel('customer/customer_collection');
00205             $this->_collections[$storeId]->getEntity()->setStore($storeId);
00206         }
00207         return $this->_collections[$storeId];
00208     }

getCustomerAddressModel (  ) 

Retrieve customer address model cache

Returns:
Mage_Customer_Model_Address

Definition at line 88 of file Customer.php.

00089     {
00090         if (is_null($this->_customerAddressModel)) {
00091             $object = Mage::getModel('customer/address');
00092             $this->_customerAddressModel = Mage::objects()->save($object);
00093         }
00094         return Mage::objects()->load($this->_customerAddressModel);
00095     }

getCustomerModel (  ) 

Retrieve customer model cache

Returns:
Mage_Customer_Model_Customer

Definition at line 74 of file Customer.php.

00075     {
00076         if (is_null($this->_customerModel)) {
00077             $object = Mage::getModel('customer/customer');
00078             $this->_customerModel = Mage::objects()->save($object);
00079         }
00080         return Mage::objects()->load($this->_customerModel);
00081     }

getExternalAttributes (  ) 

Definition at line 335 of file Customer.php.

00336     {
00337         $internal = array(
00338             'store_id',
00339             'entity_id',
00340             'website_id',
00341             'group_id',
00342             'created_in',
00343             'default_billing',
00344             'default_shipping',
00345             'country_id'
00346         );
00347 
00348         $entityTypeId = Mage::getSingleton('eav/config')->getEntityType('customer')->getId();
00349         $customerAttributes = Mage::getResourceModel('eav/entity_attribute_collection')
00350             ->setEntityTypeFilter($entityTypeId)
00351             ->load()->getIterator();
00352 
00353         $entityTypeId = Mage::getSingleton('eav/config')->getEntityType('customer_address')->getId();
00354         $addressAttributes = Mage::getResourceModel('eav/entity_attribute_collection')
00355             ->setEntityTypeFilter($entityTypeId)
00356             ->load()->getIterator();
00357 
00358         $attributes = array(
00359             'website'       => 'website',
00360             'email'         => 'email',
00361             'group'         => 'group',
00362             'create_in'     => 'create_in',
00363             'is_subscribed' => 'is_subscribed'
00364         );
00365 
00366         foreach ($customerAttributes as $attr) {
00367             $code = $attr->getAttributeCode();
00368             if (in_array($code, $internal) || $attr->getFrontendInput()=='hidden') {
00369                 continue;
00370             }
00371             $attributes[$code] = $code;
00372         }
00373         $attributes['password_hash'] = 'password_hash';
00374 
00375         foreach ($addressAttributes as $attr) {
00376             $code = $attr->getAttributeCode();
00377             if (in_array($code, $internal) || $attr->getFrontendInput()=='hidden') {
00378                 continue;
00379             }
00380             $attributes['billing_'.$code] = 'billing_'.$code;
00381         }
00382         $attributes['billing_country'] = 'billing_country';
00383 
00384         foreach ($addressAttributes as $attr) {
00385             $code = $attr->getAttributeCode();
00386             if (in_array($code, $internal) || $attr->getFrontendInput()=='hidden') {
00387                 continue;
00388             }
00389             $attributes['shipping_'.$code] = 'shipping_'.$code;
00390         }
00391         $attributes['shipping_country'] = 'shipping_country';
00392 
00393         return $attributes;
00394     }

getFields (  ) 

Definition at line 61 of file Customer.php.

00062     {
00063         if (!$this->_fields) {
00064             $this->_fields = Mage::getConfig()->getFieldset('customer_dataflow', 'admin');
00065         }
00066         return $this->_fields;
00067     }

getNewsletterModel (  ) 

Retrieve newsletter subscribers model cache

Returns:
Mage_Newsletter_Model_Subscriber

Definition at line 102 of file Customer.php.

00103     {
00104         if (is_null($this->_newsletterModel)) {
00105             $object = Mage::getModel('newsletter/subscriber');
00106             $this->_newsletterModel = Mage::objects()->save($object);
00107         }
00108         return Mage::objects()->load($this->_newsletterModel);
00109     }

getResource (  ) 

Returns:
Mage_Catalog_Model_Mysql4_Convert

Definition at line 189 of file Customer.php.

00190     {
00191         if (!$this->_resource) {
00192             $this->_resource = Mage::getResourceSingleton('catalog_entity/convert');
00193                 #->loadStores()
00194                 #->loadProducts()
00195                 #->loadAttributeSets()
00196                 #->loadAttributeOptions();
00197         }
00198         return $this->_resource;
00199     }

getStore (  ) 

Retrieve current store model

Returns:
Mage_Core_Model_Store

Definition at line 116 of file Customer.php.

00117     {
00118         if (is_null($this->_store)) {
00119             try {
00120                 $store = Mage::app()->getStore($this->getVar('store'));
00121             }
00122             catch (Exception $e) {
00123                 $this->addException(Mage::helper('catalog')->__('Invalid store specified'), Varien_Convert_Exception::FATAL);
00124                 throw $e;
00125             }
00126             $this->_store = $store;
00127         }
00128         return $this->_store;
00129     }

getStoreById ( storeId  ) 

Definition at line 144 of file Customer.php.

00145     {
00146         if (is_null($this->_stores)) {
00147             $this->_stores = Mage::app()->getStores(true);
00148         }
00149         if (isset($this->_stores[$storeId])) {
00150             return $this->_stores[$storeId];
00151         }
00152         return false;
00153     }

getStoreId (  ) 

Retrieve store ID

Returns:
int

Definition at line 136 of file Customer.php.

00137     {
00138         if (is_null($this->_storeId)) {
00139             $this->_storeId = $this->getStore()->getId();
00140         }
00141         return $this->_storeId;
00142     }

getWebsiteById ( websiteId  ) 

Retrieve website model by id

Parameters:
int $websiteId
Returns:
Mage_Core_Model_Website

Definition at line 161 of file Customer.php.

00162     {
00163         if (is_null($this->_websites)) {
00164             $this->_websites = Mage::app()->getWebsites(true);
00165         }
00166         if (isset($this->_websites[$websiteId])) {
00167             return $this->_websites[$websiteId];
00168         }
00169         return false;
00170     }

parse (  ) 

Deprecated:
not used anymore

Implements Mage_Dataflow_Model_Convert_Parser_Interface.

Definition at line 504 of file Customer.php.

00505     {
00506         $data = $this->getData();
00507 
00508         $entityTypeId = Mage::getSingleton('eav/config')->getEntityType('customer')->getId();
00509         $result = array();
00510         foreach ($data as $i=>$row) {
00511             $this->setPosition('Line: '.($i+1));
00512             try {
00513 
00514                 // validate SKU
00515                 if (empty($row['email'])) {
00516                     $this->addException(Mage::helper('customer')->__('Missing email, skipping the record'), Varien_Convert_Exception::ERROR);
00517                     continue;
00518                 }
00519                 $this->setPosition('Line: '.($i+1).', email: '.$row['email']);
00520 
00521                 // try to get entity_id by sku if not set
00522                 /*
00523                 if (empty($row['entity_id'])) {
00524                     $row['entity_id'] = $this->getResource()->getProductIdBySku($row['email']);
00525                 }
00526                 */
00527 
00528                 // if attribute_set not set use default
00529                 if (empty($row['attribute_set'])) {
00530                     $row['attribute_set'] = 'Default';
00531                 }
00532 
00533                 // get attribute_set_id, if not throw error
00534                 $row['attribute_set_id'] = $this->getAttributeSetId($entityTypeId, $row['attribute_set']);
00535                 if (!$row['attribute_set_id']) {
00536                     $this->addException(Mage::helper('customer')->__("Invalid attribute set specified, skipping the record"), Varien_Convert_Exception::ERROR);
00537                     continue;
00538                 }
00539 
00540                 if (empty($row['group'])) {
00541                     $row['group'] = 'General';
00542                 }
00543 
00544                 if (empty($row['firstname'])) {
00545                     $this->addException(Mage::helper('customer')->__('Missing firstname, skipping the record'), Varien_Convert_Exception::ERROR);
00546                     continue;
00547                 }
00548                 //$this->setPosition('Line: '.($i+1).', Firstname: '.$row['firstname']);
00549 
00550                 if (empty($row['lastname'])) {
00551                     $this->addException(Mage::helper('customer')->__('Missing lastname, skipping the record'), Varien_Convert_Exception::ERROR);
00552                     continue;
00553                 }
00554                 //$this->setPosition('Line: '.($i+1).', Lastname: '.$row['lastname']);
00555 
00556                 /*
00557                 // get product type_id, if not throw error
00558                 $row['type_id'] = $this->getProductTypeId($row['type']);
00559                 if (!$row['type_id']) {
00560                     $this->addException(Mage::helper('catalog')->__("Invalid product type specified, skipping the record"), Varien_Convert_Exception::ERROR);
00561                     continue;
00562                 }
00563                 */
00564 
00565                 // get store ids
00566                 $storeIds = $this->getStoreIds(isset($row['store']) ? $row['store'] : $this->getVar('store'));
00567                 if (!$storeIds) {
00568                     $this->addException(Mage::helper('customer')->__("Invalid store specified, skipping the record"), Varien_Convert_Exception::ERROR);
00569                     continue;
00570                 }
00571 
00572                 // import data
00573                 $rowError = false;
00574                 foreach ($storeIds as $storeId) {
00575                     $collection = $this->getCollection($storeId);
00576                     //print_r($collection);
00577                     $entity = $collection->getEntity();
00578 
00579                     $model = Mage::getModel('customer/customer');
00580                     $model->setStoreId($storeId);
00581                     if (!empty($row['entity_id'])) {
00582                         $model->load($row['entity_id']);
00583                     }
00584                     foreach ($row as $field=>$value) {
00585                         $attribute = $entity->getAttribute($field);
00586                         if (!$attribute) {
00587                             continue;
00588                             #$this->addException(Mage::helper('catalog')->__("Unknown attribute: %s", $field), Varien_Convert_Exception::ERROR);
00589 
00590                         }
00591 
00592                         if ($attribute->usesSource()) {
00593                             $source = $attribute->getSource();
00594                             $optionId = $this->getSourceOptionId($source, $value);
00595                             if (is_null($optionId)) {
00596                                 $rowError = true;
00597                                 $this->addException(Mage::helper('customer')->__("Invalid attribute option specified for attribute %s (%s), skipping the record", $field, $value), Varien_Convert_Exception::ERROR);
00598                                 continue;
00599                             }
00600                             $value = $optionId;
00601                         }
00602                         $model->setData($field, $value);
00603 
00604                     }//foreach ($row as $field=>$value)
00605 
00606 
00607                     $billingAddress = $model->getPrimaryBillingAddress();
00608                     $customer = Mage::getModel('customer/customer')->load($model->getId());
00609 
00610 
00611                     if (!$billingAddress  instanceof Mage_Customer_Model_Address) {
00612                         $billingAddress = new Mage_Customer_Model_Address();
00613                         if ($customer->getId() && $customer->getDefaultBilling()) {
00614                             $billingAddress->setId($customer->getDefaultBilling());
00615                         }
00616                     }
00617 
00618                     $regions = Mage::getResourceModel('directory/region_collection')->addRegionNameFilter($row['billing_region'])->load();
00619                     if ($regions) foreach($regions as $region) {
00620                        $regionId = $region->getId();
00621                     }
00622 
00623                     $billingAddress->setFirstname($row['firstname']);
00624                     $billingAddress->setLastname($row['lastname']);
00625                     $billingAddress->setCity($row['billing_city']);
00626                     $billingAddress->setRegion($row['billing_region']);
00627                     $billingAddress->setRegionId($regionId);
00628                     $billingAddress->setCountryId($row['billing_country']);
00629                     $billingAddress->setPostcode($row['billing_postcode']);
00630                     $billingAddress->setStreet(array($row['billing_street1'],$row['billing_street2']));
00631                     if (!empty($row['billing_telephone'])) {
00632                         $billingAddress->setTelephone($row['billing_telephone']);
00633                     }
00634 
00635                     if (!$model->getDefaultBilling()) {
00636                         $billingAddress->setCustomerId($model->getId());
00637                         $billingAddress->setIsDefaultBilling(true);
00638                         $billingAddress->save();
00639                         $model->setDefaultBilling($billingAddress->getId());
00640                         $model->addAddress($billingAddress);
00641                         if ($customer->getDefaultBilling()) {
00642                             $model->setDefaultBilling($customer->getDefaultBilling());
00643                         } else {
00644                             $shippingAddress->save();
00645                             $model->setDefaultShipping($billingAddress->getId());
00646                             $model->addAddress($billingAddress);
00647 
00648                         }
00649                     }
00650 
00651                     $shippingAddress = $model->getPrimaryShippingAddress();
00652                     if (!$shippingAddress instanceof Mage_Customer_Model_Address) {
00653                         $shippingAddress = new Mage_Customer_Model_Address();
00654                         if ($customer->getId() && $customer->getDefaultShipping()) {
00655                             $shippingAddress->setId($customer->getDefaultShipping());
00656                         }
00657                     }
00658 
00659                     $regions = Mage::getResourceModel('directory/region_collection')->addRegionNameFilter($row['shipping_region'])->load();
00660                     if ($regions) foreach($regions as $region) {
00661                        $regionId = $region->getId();
00662                     }
00663 
00664                     $shippingAddress->setFirstname($row['firstname']);
00665                     $shippingAddress->setLastname($row['lastname']);
00666                     $shippingAddress->setCity($row['shipping_city']);
00667                     $shippingAddress->setRegion($row['shipping_region']);
00668                     $shippingAddress->setRegionId($regionId);
00669                     $shippingAddress->setCountryId($row['shipping_country']);
00670                     $shippingAddress->setPostcode($row['shipping_postcode']);
00671                     $shippingAddress->setStreet(array($row['shipping_street1'], $row['shipping_street2']));
00672                     $shippingAddress->setCustomerId($model->getId());
00673                     if (!empty($row['shipping_telephone'])) {
00674                         $shippingAddress->setTelephone($row['shipping_telephone']);
00675                     }
00676 
00677                     if (!$model->getDefaultShipping()) {
00678                         if ($customer->getDefaultShipping()) {
00679                             $model->setDefaultShipping($customer->getDefaultShipping());
00680                         } else {
00681                             $shippingAddress->save();
00682                             $model->setDefaultShipping($shippingAddress->getId());
00683                             $model->addAddress($shippingAddress);
00684 
00685                         }
00686                         $shippingAddress->setIsDefaultShipping(true);
00687                     }
00688 
00689                     if (!$rowError) {
00690                         $collection->addItem($model);
00691                     }
00692 
00693                 } //foreach ($storeIds as $storeId)
00694 
00695             } catch (Exception $e) {
00696                 if (!$e instanceof Mage_Dataflow_Model_Convert_Exception) {
00697                     $this->addException(Mage::helper('customer')->__("Error during retrieval of option value: %s", $e->getMessage()), Mage_Dataflow_Model_Convert_Exception::FATAL);
00698                 }
00699             }
00700         }
00701         $this->setData($this->_collections);
00702         return $this;
00703     }

unparse (  ) 

Implements Mage_Dataflow_Model_Convert_Parser_Interface.

Definition at line 210 of file Customer.php.

00211     {
00212         $systemFields = array();
00213         foreach ($this->getFields() as $code=>$node) {
00214             if ($node->is('system')) {
00215                 $systemFields[] = $code;
00216             }
00217         }
00218 
00219         $entityIds = $this->getData();
00220 
00221         foreach ($entityIds as $i => $entityId) {
00222             $customer = $this->getCustomerModel()
00223                 ->setData(array())
00224                 ->load($entityId);
00225             /* @var $customer Mage_Customer_Model_Customer */
00226 
00227             $position = Mage::helper('catalog')->__('Line %d, Email: %s', ($i+1), $customer->getEmail());
00228             $this->setPosition($position);
00229 
00230             $row = array();
00231 
00232             foreach ($customer->getData() as $field => $value) {
00233                 if ($field == 'website_id') {
00234                     $website = $this->getWebsiteById($value);
00235                     if ($website === false) {
00236                         $website = $this->getWebsiteById(0);
00237                     }
00238                     $row['website'] = $website->getCode();
00239                     continue;
00240                 }
00241 
00242                 if (in_array($field, $systemFields) || is_object($value)) {
00243                     continue;
00244                 }
00245 
00246                 $attribute = $this->getAttribute($field);
00247                 if (!$attribute) {
00248                     continue;
00249                 }
00250 
00251                 if ($attribute->usesSource()) {
00252 
00253                     $option = $attribute->getSource()->getOptionText($value);
00254                     if ($value && empty($option)) {
00255                         $message = Mage::helper('catalog')->__("Invalid option id specified for %s (%s), skipping the record", $field, $value);
00256                         $this->addException($message, Mage_Dataflow_Model_Convert_Exception::ERROR);
00257                         continue;
00258                     }
00259                     if (is_array($option)) {
00260                         $value = join(self::MULTI_DELIMITER, $option);
00261                     } else {
00262                         $value = $option;
00263                     }
00264                     unset($option);
00265                 }
00266                 elseif (is_array($value)) {
00267                     continue;
00268                 }
00269                 $row[$field] = $value;
00270             }
00271 
00272             $defaultBillingId  = $customer->getDefaultBilling();
00273             $defaultShippingId = $customer->getDefaultShipping();
00274 
00275             $customerAddress = $this->getCustomerAddressModel();
00276 
00277             if (!$defaultBillingId) {
00278                 foreach ($this->getFields() as $code=>$node) {
00279                     if ($node->is('billing')) {
00280                         $row['billing_'.$code] = null;
00281                     }
00282                 }
00283             }
00284             else {
00285                 $customerAddress->load($defaultBillingId);
00286 
00287                 foreach ($this->getFields() as $code=>$node) {
00288                     if ($node->is('billing')) {
00289                         $row['billing_'.$code] = $customerAddress->getDataUsingMethod($code);
00290                     }
00291                 }
00292             }
00293 
00294             if (!$defaultShippingId) {
00295                 foreach ($this->getFields() as $code=>$node) {
00296                     if ($node->is('shipping')) {
00297                         $row['shipping_'.$code] = null;
00298                     }
00299                 }
00300             }
00301             else {
00302                 if ($defaultShippingId != $defaultBillingId) {
00303                     $customerAddress->load($defaultShippingId);
00304                 }
00305                 foreach ($this->getFields() as $code=>$node) {
00306                     if ($node->is('shipping')) {
00307                         $row['shipping_'.$code] = $customerAddress->getDataUsingMethod($code);
00308                     }
00309                 }
00310             }
00311 
00312             $store = $this->getStoreById($customer->getStoreId());
00313             if ($store === false) {
00314                 $store = $this->getStoreById(0);
00315             }
00316             $row['created_in'] = $store->getCode();
00317 
00318             $newsletter = $this->getNewsletterModel()
00319                 ->loadByCustomer($customer);
00320             $row['is_subscribed'] = ($newsletter->getId()
00321                 && $newsletter->getSubscriberStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
00322                 ? 1 : 0;
00323 
00324             $batchExport = $this->getBatchExportModel()
00325                 ->setId(null)
00326                 ->setBatchId($this->getBatchModel()->getId())
00327                 ->setBatchData($row)
00328                 ->setStatus(1)
00329                 ->save();
00330         }
00331 
00332         return $this;
00333     }

unparse__OLD (  ) 

Definition at line 398 of file Customer.php.

00399     {
00400         $collections = $this->getData();
00401 //        if ($collections instanceof Mage_Eav_Model_Entity_Collection_Abstract) {
00402 //            $collections = array($collections->getEntity()->getStoreId()=>$collections);
00403 //        } elseif (!is_array($collections)) {
00404 //            $this->addException(Mage::helper('customer')->__("Array of Entity collections is expected"), Varien_Convert_Exception::FATAL);
00405 //        }
00406 
00407 //        foreach ($collections as $storeId=>$collection) {
00408 //           if (!$collection instanceof Mage_Eav_Model_Entity_Collection_Abstract) {
00409 //               $this->addException(Mage::helper('customer')->__("Entity collection is expected"), Varien_Convert_Exception::FATAL);
00410 //            }
00411 
00412             $data = array();
00413 
00414             foreach ($collections->getIterator() as $i=>$model) {
00415                 $this->setPosition('Line: '.($i+1).', Email: '.$model->getEmail());
00416 
00417 
00418 
00419                 // Will be removed after confirmation from Dima or Moshe
00420                 $row = array(
00421                     'store_view'=>$this->getStoreCode($this->getVar('store') ? $this->getVar('store') : $storeId),
00422                 ); // End
00423 
00424                 foreach ($model->getData() as $field=>$value) {
00425                     // set website_id
00426                     if ($field == 'website_id') {
00427                       $row['website_code'] = Mage::getModel('core/website')->load($value)->getCode();
00428                       continue;
00429                     } // end
00430 
00431                     if (in_array($field, $systemFields)) {
00432                         continue;
00433                     }
00434 
00435                     $attribute = $model->getResource()->getAttribute($field);
00436                     if (!$attribute) {
00437                         continue;
00438                     }
00439 
00440                     if ($attribute->usesSource()) {
00441                         $option = $attribute->getSource()->getOptionText($value);
00442 
00443                         if (false===$option) {
00444                             $this->addException(Mage::helper('customer')->__("Invalid option id specified for %s (%s), skipping the record", $field, $value), Mage_Dataflow_Model_Convert_Exception::ERROR);
00445                             continue;
00446                         }
00447                         if (is_array($option)) {
00448                             $value = $option['label'];
00449                         } else {
00450                             $value = $option;
00451                         }
00452                     }
00453                     $row[$field] = $value;
00454 
00455                     $billingAddress = $model->getDefaultBillingAddress();
00456                     if($billingAddress instanceof Mage_Customer_Model_Address){
00457                         $billingAddress->explodeStreetAddress();
00458                         $row['billing_street1']     = $billingAddress->getStreet1();
00459                         $row['billing_street2']     = $billingAddress->getStreet2();
00460                         $row['billing_city']        = $billingAddress->getCity();
00461                         $row['billing_region']      = $billingAddress->getRegion();
00462                         $row['billing_country']     = $billingAddress->getCountry();
00463                         $row['billing_postcode']    = $billingAddress->getPostcode();
00464                         $row['billing_telephone']   = $billingAddress->getTelephone();
00465                     }
00466 
00467                     $shippingAddress = $model->getDefaultShippingAddress();
00468                     if($shippingAddress instanceof Mage_Customer_Model_Address){
00469                         $shippingAddress->explodeStreetAddress();
00470                         $row['shipping_street1']    = $shippingAddress->getStreet1();
00471                         $row['shipping_street2']    = $shippingAddress->getStreet2();
00472                         $row['shipping_city']       = $shippingAddress->getCity();
00473                         $row['shipping_region']     = $shippingAddress->getRegion();
00474                         $row['shipping_country']    = $shippingAddress->getCountry();
00475                         $row['shipping_postcode']   = $shippingAddress->getPostcode();
00476                         $row['shipping_telephone']  = $shippingAddress->getTelephone();
00477                     }
00478 
00479                     if($model->getGroupId()){
00480                         $group = Mage::getResourceModel('customer/group_collection')
00481                         ->addFilter('customer_group_id',$model->getGroupId())
00482                         ->load();
00483                         $row['group']=$group->getFirstItem()->getData('customer_group_code');
00484                     }
00485                 }
00486                 $subscriber = Mage::getModel('newsletter/subscriber')->loadByCustomer($model);
00487                 if ($subscriber->getId()) {
00488                     $row['is_subscribed'] = $subscriber->getSubscriberStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED ? Mage_Customer_Model_Customer::SUBSCRIBED_YES : Mage_Customer_Model_Customer::SUBSCRIBED_NO;
00489                 }
00490                 if(!isset($row['created_in'])){
00491                     $row['created_in'] = 'Admin';
00492                 }
00493                 $data[] = $row;
00494 
00495             }
00496 //       }
00497         $this->setData($data);
00498         return $this;
00499     }


Member Data Documentation

$_attributes = array() [protected]

Definition at line 57 of file Customer.php.

$_collections [protected]

Definition at line 41 of file Customer.php.

$_customerAddressModel [protected]

Definition at line 44 of file Customer.php.

$_customerModel [protected]

Definition at line 43 of file Customer.php.

$_fields [protected]

Definition at line 59 of file Customer.php.

$_newsletterModel [protected]

Definition at line 45 of file Customer.php.

$_resource [protected]

Definition at line 34 of file Customer.php.

$_store [protected]

Definition at line 46 of file Customer.php.

$_storeId [protected]

Definition at line 47 of file Customer.php.

$_stores [protected]

Definition at line 49 of file Customer.php.

$_websites [protected]

Definition at line 56 of file Customer.php.

const MULTI_DELIMITER = ' , '

Definition at line 32 of file Customer.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:03 2009 for Magento by  doxygen 1.5.8