سؤال

I need to extend Mage_CatalogSearch_Block_Result, but something i did wrong.. can someone please help me?

community/Folder/MyName/Block/Result.php

<?php
class Folder_MyName_Block_Result extends Mage_CatalogSearch_Block_Result
{  .... }
?> 

I think that the problem is here: community/Folder/MyName/etc/config.xml

<global>
    <blocks>
        <myname>
            <class>Folder_MyName_Block</class>
        </myname>
        <catalog>
            <rewrite>
                <catalogsearch>Folder_MyName_Block_Result</catalogsearch>
            </rewrite>
        </catalog>
    </blocks>
</global>
هل كانت مفيدة؟

المحلول

It might be not obvious but search functionality doesn't live inside of a catalog module but in catalogsearch. So here is how your rewrite shall look like:

<catalogsearch>
    <rewrite>
        <result>Folder_MyName_Block_Result</result>
    </rewrite>
</catalogsearch>

And a small side-note. The closing ?> in your PHP files is redundant. It may look good from a styling point of view, but in some cases it may cause Headers already sent issue if you have a space after it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top