Posted on Leave a comment

Magento – Not currently favorite color

Why is debugging and troubleshooting in Magento so difficult? Because of error messages like this:

Notice: Undefined variable: rootNode in C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Config.php on line 53
Trace:
#0 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Config.php(53): mageCoreErrorHandler(8, ‘Undefined varia…’, ‘C:\Domains\exam…’, 53, Array)
#1 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Widget\Form.php(196): Mage_Eav_Model_Entity_Attribute_Source_Config->getAllOptions(true, true)
#2 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tab\Account.php(54): Mage_Adminhtml_Block_Widget_Form->_setFieldset(Array, Object(Varien_Data_Form_Element_Fieldset))
#3 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tabs.php(58): Mage_Adminhtml_Block_Customer_Edit_Tab_Account->initForm()
#4 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(642): Mage_Adminhtml_Block_Customer_Edit_Tabs->_beforeToHtml()
#5 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Text\List.php(43): Mage_Core_Block_Abstract->toHtml()
#6 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(643): Mage_Core_Block_Text_List->_toHtml()
#7 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#8 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml(‘left’, true)
#9 C:\Domains\example.com\wwwroot\magento\app\design\adminhtml\default\default\template\page.phtml(58): Mage_Core_Block_Abstract->getChildHtml(‘left’)
#10 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(144): include(‘C:\Domains\leoa…’)
#11 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(176): Mage_Core_Block_Template->fetchView(‘adminhtml\defau…’)
#12 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(193): Mage_Core_Block_Template->renderView()
#13 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#14 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(643): Mage_Adminhtml_Block_Template->_toHtml()
#15 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Model\Layout.php(526): Mage_Core_Block_Abstract->toHtml()
#16 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(347): Mage_Core_Model_Layout->getOutput()
#17 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Adminhtml\controllers\CustomerController.php(117): Mage_Core_Controller_Varien_Action->renderLayout()
#18 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(376): Mage_Adminhtml_CustomerController->editAction()
#19 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch(‘edit’)
#20 C:\Domains\example.com\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 C:\Domains\example.com\wwwroot\magento\app\Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#22 C:\Domains\example.com\wwwroot\magento\index.php(65): Mage::run()
#23 {main}

Yes, it screams "undefined variable" which is rootNode but through Magento’s excellent use of object oriented spaghetti, the error does not in anyway reveal what is truly causing rootNode to be undefined nor where to even begin looking.

Posted on Leave a comment

Current Magento Questions – getCustomerFormData

The Magento ecommerce question I am trying to answer right now is what does getCustomerFormData() do?

In AccountController.php and Register.php there is this reference $data = $this->_getSession()->getCustomerFormData(true); and this reference $data = new Varien_Object(Mage::getSingleton(‘customer/session’)->getCustomerFormData(true)); respectively. I’ve searched using grep and within eclipse’s file search but can find no other reference to getCustomerFormData.

I can find no reference to getCustomerFormData other than these two lines of code. So what is this supposed to be accomplishing?

Posted on 2 Comments

Magento Actions

The Magento E-commerce system is an exciting open source alternative to systems like OS Commerce. The learning curve isn’t really a curve at all. The learning curve is more like a sheer, glassy. polished mountain face shooting straight up into the heavens. However, plenty of documentation exists, Google overfloweth with links to blog post, and IRC support is available on Freenode #magento (although I believe most questions go to /dev/null so expect to feel a little like you are talking to yourself but like your $200/hr psychologist will explain, sometimes that’s all we need).

As I work through understanding how Magento handles layouts, I struggle to find a simple list of actions and perhaps I’m trying to hard. So far the is this:

addJs
addCss
addLink
addItemRender
unsetChild
setHeaderTitle
setTemplate

Ah! I found a reference! See page 7 of Magento Layout Files Reference (see also same document, different format).

Update: The Magento wiki has this defined under Designing for Magento.