Экспорт клиента не работает после создания пользовательских атрибутов для customer_address

У меня проблема с экспортом в Magento 1.9 собственных функций клиента. Когда я хочу экспортировать клиентов, я получаю эту ошибку:

Неустранимая ошибка: необработанная ошибка: вызов функции-члена getFrontendInput () со значением NULL в … \ app \ code \ core \ Mage \ ImportExport \ Model \ Export \ Entity \ Customer.php в строке 201

Эта строка: if ($addressAttribute->getFrontendInput() == 'multiselect') {...}

После отладки кода я обнаружил, что проблема в том, что я создал несколько пользовательских атрибутов для типа customer_address.

Может быть, я не создал правильно, это мой установщик:

$installer = $this;

$installer->startSetup();

$forms = array(
'customer_register_address',
'customer_address_edit',
'adminhtml_customer_address'
);

/**
* Create customer_cnp attribute
*/
$installer->addAttribute('customer_address', 'blugento_customer_cnp', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'CNP',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'visible_on_front' => 1
));
Mage::getSingleton('eav/config')
->getAttribute('customer_address', 'blugento_customer_cnp')
->setData('used_in_forms', $forms)
->save();

/**
* Create customer_reg_no attribute
*/
$installer->addAttribute('customer_address', 'blugento_customer_reg_no', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'Company Registration Number',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'visible_on_front' => 1
));
Mage::getSingleton('eav/config')
->getAttribute('customer_address', 'blugento_customer_reg_no')
->setData('used_in_forms', $forms)
->save();

/**
* Create customer_iban attribute
*/
$installer->addAttribute('customer_address', 'blugento_customer_iban', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'IBAN',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'visible_on_front' => 1
));
Mage::getSingleton('eav/config')
->getAttribute('customer_address', 'blugento_customer_iban')
->setData('used_in_forms', $forms)
->save();

/**
* Create customer_bank attribute
*/
$installer->addAttribute('customer_address', 'blugento_customer_bank', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'Bank Name',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'visible_on_front' => 1
));
Mage::getSingleton('eav/config')
->getAttribute('customer_address', 'blugento_customer_bank')
->setData('used_in_forms', $forms)
->save();

/**
* Add columns for new attributes in sales_flat_order_address and
sales_flat_quote_address
*/
$tableQuote = $this->getTable('sales/quote_address');
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_cnp` VARCHAR(150) NULL DEFAULT NULL");
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_reg_no` VARCHAR(150) NULL DEFAULT NULL");
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_iban` VARCHAR(150) NULL DEFAULT NULL");
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_bank` VARCHAR(150) NULL DEFAULT NULL");

$tableQuote = $this->getTable('sales/order_address');
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_cnp` VARCHAR(150) NULL DEFAULT NULL");
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_reg_no` VARCHAR(150) NULL DEFAULT NULL");
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_iban` VARCHAR(150) NULL DEFAULT NULL");
$installer->run("ALTER TABLE  $tableQuote ADD `blugento_customer_bank` VARCHAR(150) NULL DEFAULT NULL");

$installer->endSetup();

После дополнительной отладки я обнаружил, что, если ни один из моих клиентов не завершил эти новые атрибуты адреса, экспорт работает, поэтому только если есть значения, завершенные для этих атрибутов, я получил ошибку.

Может кто-нибудь сказать мне, что я делаю не так? Спасибо!

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …