删除或替换magento的版权

时间:2015-11-14 18:38:51

标签: php magento magento-1.9

据我所知:要删除或替换magento的版权,我们需要这样做: “转到系统>配置”并更改版权。 或打开文件template/page/footer.phtml删除

<?php echo $this->getCopyright() ?>

我的目的是用我的函数替换getCopyright()以显示我的自定义模块的其他内容。任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

'getCopyright'方法在'Mage_Page_Block_Html_Footer'类中定义。您的扩展程序应覆盖此类。另一种方法是用扩展名中的块替换此块。

config.xml中的块覆盖声明应如下所示:

<?xml version="1.0"?> 
<config>
    ...
    <global>
        <blocks>
            <page>
                <rewrite>
                     <html_footer>Novaweb_Novawebaddons_Block_Copyright</html_footer>
                </rewrite>
            </page>
        </blocks>
        <cms>
            <page>
                <tempate_filter>Novaweb_Novawebaddons_Model_Filter</tempate_filter>
            </page>
            <block>
                <tempate_filter>Novaweb_Novawebaddons_Model_Filter</tempate_filter>
            </block>
        </cms>
    </global>
    ...
</config>

'Novaweb / Novawebaddons / Model / Filter.php'文件:

<?php
class Novaweb_Novawebaddons_Model_Filter extends Mage_Cms_Model_Template_Filter
{
    public function configDirective($construction)
    {
        $params = $this->_getIncludeParameters($construction[2]);
        if (!empty($params['path']) && ($params['path'] == 'design/footer/copyright'))
            return 'My copyright';

        return parent::configDirective($construction);
    }
}