当前位置: 动力学知识库 > 问答 > 编程问答 >

Magento rewrite block doesn't work

问题描述:

I need to override a method in a Magento core file, I am pretty sure I have done it the correct way and it is working on someone else's machine, but it's just not working on my own machine. We have the same environment. It's pretty weird I couldn't find out why and I have checked the file permissions, still don't see any light in solving the problem. Wonder has anyone run into the same problem? I am running 1.7

Many thanks!

--Update--

My custom block class (app/code/local/Company/Cms/Block/Page.php)

require_once("Mage/Cms/Block/Page.php");

class Company_Cms_Block_Page extends Mage_Cms_Block_Page

{

protected function _prepareLayout()

{

// my code

}

}

app/code/local/Company/Cms/etc/config.xml

<?xml version="1.0"?>

<config>

<modules>

<Company_Cms>

<version>0.0.1</version>

</Company_Cms>

</modules>

<global>

<blocks>

<cms>

<rewrite>

<page>Company_Cms_Block_Page</page>

</rewrite>

</cms>

</blocks>

</global>

</config>

app/etc/modules/Company_Cms.xml

<?xml version="1.0"?>

<config>

<modules>

<Company_Cms>

<active>true</active>

<codePool>local</codePool>

</Company_Cms>

</modules>

</config>

This custom module isn't being executed at all as nothing changes unless I change code in core block class.

分享给朋友:
您可能感兴趣的文章:
随机阅读: