Beispiel #1
0
 /**
  * Constructor
  *
  * @param array $data
  */
 public function __construct(array $data = array())
 {
     parent::__construct($data);
     $this->_websiteManager = isset($data['website_manager']) ? $data['website_manager'] : Mage::app();
     $this->_storeManager = isset($data['store_manager']) ? $data['store_manager'] : Mage::app();
     $this->_attributeCollection = isset($data['attribute_collection']) ? $data['attribute_collection'] : Mage::getResourceModel(static::ATTRIBUTE_COLLECTION_NAME);
     if (isset($data['entity_type_id'])) {
         $this->_entityTypeId = $data['entity_type_id'];
     } else {
         $this->_entityTypeId = Mage::getSingleton('Mage_Eav_Model_Config')->getEntityType($this->getEntityTypeCode())->getEntityTypeId();
     }
 }
Beispiel #2
0
 /**
  * Class constructor
  *
  * @param array $data
  */
 public function __construct(array $data = array())
 {
     parent::__construct($data);
     $this->addMessageTemplate(self::ERROR_ROW_IS_ORPHAN, $this->_helper('Mage_ImportExport_Helper_Data')->__('Orphan rows that will be skipped due default row errors'));
     $this->_availableBehaviors = array(Mage_ImportExport_Model_Import::BEHAVIOR_APPEND, Mage_ImportExport_Model_Import::BEHAVIOR_DELETE);
     // customer entity stuff
     if (isset($data['customer_data_source_model'])) {
         $this->_dataSourceModels['customer'] = $data['customer_data_source_model'];
     } else {
         $arguments = array('entity_type' => Mage_ImportExport_Model_Import_Entity_CustomerComposite::COMPONENT_ENTITY_CUSTOMER);
         $this->_dataSourceModels['customer'] = Mage::getResourceModel('Mage_ImportExport_Model_Resource_Import_CustomerComposite_Data', array('arguments' => $arguments));
     }
     if (isset($data['customer_entity'])) {
         $this->_customerEntity = $data['customer_entity'];
     } else {
         $data['data_source_model'] = $this->_dataSourceModels['customer'];
         $this->_customerEntity = Mage::getModel('Mage_ImportExport_Model_Import_Entity_Eav_Customer', array('data' => $data));
         unset($data['data_source_model']);
     }
     $this->_initCustomerAttributes();
     // address entity stuff
     if (isset($data['address_data_source_model'])) {
         $this->_dataSourceModels['address'] = $data['address_data_source_model'];
     } else {
         $arguments = array('entity_type' => Mage_ImportExport_Model_Import_Entity_CustomerComposite::COMPONENT_ENTITY_ADDRESS, 'customer_attributes' => $this->_customerAttributes);
         $this->_dataSourceModels['address'] = Mage::getResourceModel('Mage_ImportExport_Model_Resource_Import_CustomerComposite_Data', array('arguments' => $arguments));
     }
     if (isset($data['address_entity'])) {
         $this->_addressEntity = $data['address_entity'];
     } else {
         $data['data_source_model'] = $this->_dataSourceModels['address'];
         $this->_addressEntity = Mage::getModel('Mage_ImportExport_Model_Import_Entity_Eav_Customer_Address', array('data' => $data));
         unset($data['data_source_model']);
     }
     $this->_initAddressAttributes();
     // next customer id
     if (isset($data['next_customer_id'])) {
         $this->_nextCustomerId = $data['next_customer_id'];
     } else {
         /** @var $resourceHelper Mage_ImportExport_Model_Resource_Helper_Mysql4 */
         $resourceHelper = Mage::getResourceHelper('Mage_ImportExport');
         $this->_nextCustomerId = $resourceHelper->getNextAutoincrement($this->_customerEntity->getEntityTable());
     }
 }