J Ha
J Ha

Reputation: 1262

Remove or replace copyright in magento

As i know: to remove or replace the copyright in magento we need to do: "Go to System > Configuration" and change copyright. or open file template/page/footer.phtml remove

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

My purpose is replace getCopyright() by my function to show the other content with my custom module. Can anyone help me?

Upvotes: 0

Views: 2130

Answers (1)

Neodan
Neodan

Reputation: 5252

The 'getCopyright' method is defined in the 'Mage_Page_Block_Html_Footer' class. Your extension should override this class. The other way is replace this block with block from your extension.

The declaration of the block override in the config.xml should look like:

<?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' file:

<?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);
    }
}

Upvotes: 1

Related Questions