Magento Forum

   
HELP! Can’t add field to database
 
matteoweb
Member
 
Total Posts:  55
Joined:  2008-07-14
 

I’m trying to add a new field to the onepage checkout. I copy and paste all the code of the field “postcode”, renameing it. Now, i should only add this field into db.

Following the guide lines of Moshe (see this thread: http://www.magentocommerce.com/boards/viewthread/1104/), i put into onepage.phtml those lines at the top of the page:

<?php
    $setup 
Mage::getModel('sales/entity_setup');
    
//my_debug($setup->getDefaultEntities());
    
$setup->installEntities($setup->getDefaultEntities());
?>

Refreshing the page, i get this error:

Notice: Array to string conversion in /var/www/new_store/app/code/core/Mage/Core/Model/Config.php on line 775

#0 /var/www/new_store/app/code/core/Mage/Core/Model/Config.php(775): mageCoreErrorHandler(8, ‘Array to string...’, ‘/var/www/new_st...’, 775, Array)
#1 /var/www/new_store/app/code/core/Mage/Core/Model/Resource/Setup.php(58): Mage_Core_Model_Config->getResourceConfig(Array)
#2 /var/www/new_store/app/code/core/Mage/Core/Model/Config.php(721): Mage_Core_Model_Resource_Setup->__construct(Array)
#3 /var/www/new_store/app/Mage.php(314): Mage_Core_Model_Config->getModelInstance(’sales/entity_se...’, Array)
#4 /var/www/new_store/app/design/frontend/default/new_store/template/checkout/onepage.phtml(28): Mage::getModel(’sales/entity_se...’)
#5 /var/www/new_store/app/code/core/Mage/Core/Block/Template.php(144): include(’/var/www/spagno...’)
#6 /var/www/new_store/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView(’frontend/defaul...’)
#7 /var/www/new_store/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#8 /var/www/new_store/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#9 /var/www/new_store/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#10 /var/www/new_store/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Text_List->_toHtml()
#11 /var/www/new_store/app/code/core/Mage/Core/Block/Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#12 /var/www/new_store/app/code/core/Mage/Core/Block/Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml(’content’, true)
#13 /var/www/new_store/app/design/frontend/default/new_store/template/page/2columns-right.phtml(56): Mage_Core_Block_Abstract->getChildHtml(’content’)
#14 /var/www/new_store/app/code/core/Mage/Core/Block/Template.php(144): include(’/var/www/new_st...’)
#15 /var/www/new_store/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView(’frontend/defaul...’)
#16 /var/www/new_store/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#17 /var/www/new_store/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#18 /var/www/new_store/app/code/core/Mage/Core/Model/Layout.php(515): Mage_Core_Block_Abstract->toHtml()
#19 /var/www/new_store/app/code/core/Mage/Core/Controller/Varien/Action.php(326): Mage_Core_Model_Layout->getOutput()
#20 /var/www/new_store/app/code/local/Mage/Checkout/controllers/OnepageController.php(138): Mage_Core_Controller_Varien_Action->renderLayout()
#21 /var/www/new_store/app/code/core/Mage/Core/Controller/Varien/Action.php(349): Mage_Checkout_OnepageController->indexAction()
#22 /var/www/new_store/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(163): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#23 /var/www/new_store/app/code/core/Mage/Core/Controller/Varien/Front.php(174): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#24 /var/www/new_store/app/Mage.php(447): Mage_Core_Controller_Varien_Front->dispatch()
#25 /var/www/new_store/index.php(46): Mage::run()
#26 {main}

The line 775 contains this:
public function getResourceConfig($name)
{
//return $this->getNode("global/resources/$name");
return $this->_xml->global->resources->{$name};
}

If i invert the commented line, no errors appears and no field went created into db.

Please help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
elituchy
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2008-10-10
Port Washington, NY
 

Any update on this?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top