Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

override block template - Links.php
 
jason_rsc
Jr. Member
 
Total Posts:  16
Joined:  2009-12-07
 

I’m trying to override the Mage_Page_Block_Template_Links class with a new addLinks method
the override works fine if I place the new class in
app/code/local/Mage/Page/Block/Template/Links.php
and keeping the class name the same

but I wish to stay modular compliant
so I created three files:

1. app/code/local/Rsc/Page/Block/Template/Links.php

class Rsc_Page_Block_Template_Links extends Mage_Core_Block_Template {
...
// my override of addLinks( )
...
}

2. app/code/local/Rsc/Page/etc/config.xml

<?xml version="1.0"?>

<!--
    
Document   config.xml
-->

<
config>
    <global>
        <
blocks>
            <
page>
                <
rewrite>
                    <
links>Rsc_Page_Block_Template_Links</links>
                </
rewrite>
            </
page>
        </
blocks>
    </global>
</
config>

3. app/etc/modules/Rsc_All.xml

<?xml version="1.0"?>

<!--
    
Document   RSC.xml
-->

<
config>
    <
modules>
        <
Rsc_Page>
            <
active>true</active>
            <
codePool>local</codePool>
        </
Rsc_Page>
    </
modules>
</
config>

the cache is disabled and Rsc_Page is showing up in admin/system/advanced/advanced

thanks in advance for any help

 
Magento Community Magento Community
Magento Community
Magento Community
 
raska__
Member
 
Total Posts:  42
Joined:  2009-05-24
 

Hello,
you solved it?
I have the problem.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Saggy
Sr. Member
 
Total Posts:  133
Joined:  2009-02-03
 

Try changing block part of your config file to this -:

<blocks>
            <
page>
                <
rewrite>
                    <
template_links>Rsc_Page_Block_Template_Links</links>
                </
rewrite>
            </
page>
        </
blocks>
jason_rsc - 28 December 2009 04:07 PM

I’m trying to override the Mage_Page_Block_Template_Links class with a new addLinks method
the override works fine if I place the new class in
app/code/local/Mage/Page/Block/Template/Links.php
and keeping the class name the same

but I wish to stay modular compliant
so I created three files:

1. app/code/local/Rsc/Page/Block/Template/Links.php

class Rsc_Page_Block_Template_Links extends Mage_Core_Block_Template {
...
// my override of addLinks( )
...
}

2. app/code/local/Rsc/Page/etc/config.xml
<?xml version="1.0"?>

<!--
    
Document   config.xml
-->

<
config>
    <global>
        <
blocks>
            <
page>
                <
rewrite>
                    <
links>Rsc_Page_Block_Template_Links</links>
                </
rewrite>
            </
page>
        </
blocks>
    </global>
</
config>

3. app/etc/modules/Rsc_All.xml
<?xml version="1.0"?>

<!--
    
Document   RSC.xml
-->

<
config>
    <
modules>
        <
Rsc_Page>
            <
active>true</active>
            <
codePool>local</codePool>
        </
Rsc_Page>
    </
modules>
</
config>

the cache is disabled and Rsc_Page is showing up in admin/system/advanced/advanced

thanks in advance for any help
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top