1

After changing the frontend_input of City attribute from text to select and then saving a customer address record, above error message get displayed at the index action of address controller, which is the view page without form components. However, on the edit page was loaded finely. Here's the detail

Resource Setup script (result: updated successfully)

$installer->updateAttribute('customer_address', 'city', 'frontend_input', 'select');


Value shown in 'customer_address_entity_varchar' table after saving
+-----------+------------------+---------------+-----------+-----------+
| value_id | entity_type_id | attribute_id | entity_id |   value   |
+-----------+------------------+---------------+-----------+-----------+
|      5        |         2            |         26       |       1      | Chicago |
+-----------+------------------+---------------+-----------+-----------+


Error Detail

Failed to load node  from config

#0 C:\Software\wamp\www\company\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Config.php(61): Mage::exception('Mage_Eav', 'Failed to load ...')
#1 C:\Software\wamp\www\company\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Abstract.php(82): Mage_Eav_Model_Entity_Attribute_Source_Config->getAllOptions()
#2 C:\Software\wamp\www\company\app\code\core\Mage\Eav\Model\Attribute\Data\Select.php(114): Mage_Eav_Model_Entity_Attribute_Source_Abstract->getOptionText('Chicago')
#3 C:\Software\wamp\www\company\app\code\core\Mage\Eav\Model\Attribute\Data\Select.php(131): Mage_Eav_Model_Attribute_Data_Select->_getOptionText('Chicago')
#4 C:\Software\wamp\www\company\app\code\core\Mage\Customer\Block\Address\Renderer\Default.php(111): Mage_Eav_Model_Attribute_Data_Select->outputValue('html')
#5 C:\Software\wamp\www\company\app\code\core\Mage\Customer\Model\Address\Abstract.php(330): Mage_Customer_Block_Address_Renderer_Default->render(Object(Mage_Customer_Model_Address))
#6 C:\Software\wamp\www\company\app\code\core\Mage\Customer\Block\Address\Book.php(90): Mage_Customer_Model_Address_Abstract->format('html')
#7 C:\Software\wamp\www\company\app\design\frontend\base\default\template\customer\address\book.phtml(46): Mage_Customer_Block_Address_Book->getAddressHtml(Object(Mage_Customer_Model_Address))
#8 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Template.php(241): include('C:\Software\wam...')
#9 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('frontend\base\d...')
#10 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#11 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#12 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#13 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(522): Mage_Core_Block_Abstract->_getChildHtml('address_book', true)
#14 C:\Software\wamp\www\company\app\code\core\Mage\Page\Block\Html\Wrapper.php(52): Mage_Core_Block_Abstract->getChildHtml('', true, true)
#15 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Page_Block_Html_Wrapper->_toHtml()
#16 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Text\List.php(43): Mage_Core_Block_Abstract->toHtml()
#17 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#18 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#19 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#20 C:\Software\wamp\www\company\app\design\frontend\ultimo\default\template\page\2columns-left.phtml(51): Mage_Core_Block_Abstract->getChildHtml('content')
#21 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Template.php(241): include('C:\Software\wam...')
#22 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Template.php(272): Mage_Core_Block_Template->fetchView('frontend\ultimo...')
#23 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Template.php(286): Mage_Core_Block_Template->renderView()
#24 C:\Software\wamp\www\company\app\code\core\Mage\Core\Block\Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#25 C:\Software\wamp\www\company\app\code\core\Mage\Core\Model\Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#26 C:\Software\wamp\www\company\app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput()
#27 C:\Software\wamp\www\company\app\code\core\Mage\Customer\controllers\AddressController.php(70): Mage_Core_Controller_Varien_Action->renderLayout()
#28 C:\Software\wamp\www\company\app\code\core\Mage\Core\Controller\Varien\Action.php(419): Mage_Customer_AddressController->indexAction()
#29 C:\Software\wamp\www\company\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#30 C:\Software\wamp\www\company\app\code\core\Mage\Core\Controller\Varien\Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#31 C:\Software\wamp\www\company\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#32 C:\Software\wamp\www\company\app\Mage.php(683): Mage_Core_Model_App->run(Array)
#33 C:\Software\wamp\www\company\index.php(87): Mage::run('', 'store')
#34 {main}
1
  • Above change also impacted to admin panel, error say Source model "" not found for attribute "city".
    – Leongelis
    Commented Jan 25, 2014 at 19:21

1 Answer 1

0

You need also set a source_model with your select type attributes. Have a look at the country attribute for an example.

Mage_Customer_Model_Resource_Address_Attribute_Source_Country

This class has a function getAllOptions which is used to populate the select drop down.

public function getAllOptions()
{
    if (!$this->_options) {
        $this->_options = Mage::getResourceModel('directory/country_collection')
            ->loadByStore($this->getAttribute()->getStoreId())->toOptionArray();
    }
    return $this->_options;
}

If you create a model and update your attribute to use it then you just need to write a getAllOptions to load an array containing each value.

If you do not want to create your own source model you can use eav/entity_attribute_source_table and use the following install script code to add options.

$attribute_id = $installer->getAttributeId($entityTypeId, 'city');
$cities = array('City1','City2');
$option = array();
$option['attribute_id'] = $attribute_id;

for($i=0; $o<sizeof($cities);$i++){
    $option['value']['option'.$i][0] = $cities[$i];
}
$setup->addAttributeOption($option);

Note: The reason it works on the display as I assume you still have some text values linked to this attribute in the varchar eav table

1
  • David, your guidance is really helpful. I decided to create a source model for 'City' attribute and updated the column source_model in eav_attribute table. Now no error, and will continue to enhance displaying the City value on screen. Many thanks.
    – Leongelis
    Commented Jan 26, 2014 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.