0

I need a quick help, need to override

app\code\core\Mage\CatalogSearch\Block\Result.php 

How do I do that in my module?

1 Answer 1

2

app/etc/modules/Package_CatalogSearch.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Package_CatalogSearch>
      <active>true</active>
      <codePool>local</codePool>
    </Package_CatalogSearch>
  </modules>
</config>

Now inside module, app/code/local/Package/CatalogSearch/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Package_CatalogSearch>
      <version>1.0.0</version>
    </Package_CatalogSearch>
  </modules>

    <global>
        <blocks>
            <catalogsearch>
                <rewrite>
                    <result>Package_CatalogSearch_Block_Result</result>
                </rewrite>
            </catalogsearch>
        </blocks>
    </global>
</config>

app/code/local/Package/CatalogSearch/Block/Result.php and a class has to be defined:

class Package_CatalogSearch_Block_Result extends Mage_CatalogSearch_Block_Result
{
        // some code here
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.