I’m trying to override a phtml file within Magento’s admin area. Specifically, the file I’m trying to override is: app/design/adminhtml/default/default/template/catalog/form/renderer/fieldset/element.phtml
In app/code/local/CompanyName/Website/etc/config.xml, I have:
<rewrite>
<catalog_form_renderer_fieldset_element>CompanyName_Website_Block_Adminhtml_Catalog_Form_Renderer_Fieldset_Element</catalog_form_renderer_fieldset_element>
</rewrite>
The overriding block PHP file I have placed into app/code/local/CompanyName/Website/Block/Adminhtml/Catalog/Form/Renderer/Fieldset/Element.php. This file contains:
<?php
class CompanyName_Website_Block_Adminhtml_Catalog_Form_Renderer_Fieldset_Element extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element
{
public function _construct()
{
parent::_construct();
$this->setTemplate('catalog/form/renderer/fieldset/element.phtml');
}
}
Finally, the overriding template file is at app/design/frontend/enterprise/CompanyName/template/catalog/form/renderer/fieldset/element.phtml and contains the actual template I’m overriding.
I get a white screen and in the log there’s this error: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 227543041 bytes) in /var/www/html/gold/lib/Varien/Object.php on line 569
Any thoughts? Am I extending the right class? Files placed correctly? Etc. There are other <rewrite> blocks inside the same config.xml file which work just fine so I must be making a mistake!
Thanks.
This is odd for a couple of reasons.
It seems that you are merely interested in changing the template of this block. Why not just override its default template ‘widget/form/renderer/fieldset/element.phtml’?
Are you sure you don’t have something like print_r($someObject->getData()); somewhere in your constructor or template?
Further Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element::_construct() merely sets the template file, so probably no reason to call parent::_construct().
Have you set some error_log()’s around in your constructor and template file to make sure they are being called? What is the full path to that template? Namely is it something like /app/design/adminhtml/default/default…? or /app/design/adminhtml/company/…? If the later, I assume you have the suitable config in place to allow for adminhtml template override?
What is going on in line 569 of /lib/Varien/Object.php? (mine must be a different version because that line is in a comment and its around stuff that doesn’t seem relevant)
EDIT:
To override an adminhtml template. Add this to the < config > node in /app/etc/local.xml
Now make a folder in /app/design/adminhtml/default/ named ‘companyname’ and put ‘template’, ‘layout’ etc. folders inside it as you would any theme. e.g. /app/design/adminhtml/default/companyname/template/widget/form/renderer/fieldset/element.phtml for your case.