As explained in my PM, I also post it here for the benefit of other users of the Override Engine:
Basically, when you plan to extend the
admin/controller/catalog/product.php class, you'd most likely also want to want the modify the
admin/view/template/catalog/product_form.tpl and
admin/language/english/catalog/product.php files, hence you'd have these files:
override/mystuff/admin/controller/catalog/product.php
override/mystuff/admin/language/english/catalog/product.php
The
override/mystuff/admin/controller/catalog/product.php usually is the one which modifies both the controller and the template, it has to look something like this:
Code: Select all
<?php
class mystuff_ControllerCatalogProduct extends ControllerCatalogProduct {
// overridden method
public function preRender( $template_buffer, $template_name, &$data ) {
if ($template_name != 'catalog/product_form.tpl') {
return parent::preRender( $template_buffer, $template_name, $data );
}
// add additional or modified controller variables
$this->load->language('catalog/product');
$this->load->model('catalog/product');
$data['xxxx'] = ....;
// modify the the template, to use the additional or modified variables
$this->load->helper( 'modifier' );
$search = '.....';
$add = <<<'EOT'
..... template modifications ....
EOT;
$template_buffer = Modifier::modifyStringBuffer( $template_buffer,$search,$add,'after',0 );
// call parent preRender method
return parent::preRender( $template_buffer, $template_name, $data );
}
}
?>