0

Cant rewrite Mage_Review_Block_Product_View for some reason.

In my config file I have:

   <?xml version="1.0"?>
<config>
    <modules>
        <NameSpace_ModuleName>
            <version>0.0.1</version>
        </NameSpace_ModuleName>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <NameSpace_ModuleName before="Mage_Adminhtml">NameSpace_ModuleName_Adminhtml</NameSpace_ModuleName>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <adminhtml>
        <layout>
            <updates>
                <Review>
                    <file>namespace/review.xml</file>
                </Review>
            </updates>
        </layout>
    </adminhtml>
    <frontend>
        <routers>
            <review>
                <args>
                    <modules>
                        <NameSpace_ModuleName before="Mage_Review">NameSpace_ModuleName</NameSpace_ModuleName> 
                    </modules>
                </args>
            </review>
        </routers>
        <layout>
            <updates>
                <Review>
                    <file>namespace/product-review-extended.xml</file>
                </Review>
            </updates>
        </layout>
    </frontend>
    <global>
        <helpers>
            <Review>
                <class>NameSpace_ModuleName_Helper</class>
            </Review>
        </helpers>  
        <blocks>
            <Review> 
                <class>NameSpace_ModuleName_Block</class> 
            </Review>
            <review>
                <rewrite>
                    <product_view>NameSpace_ModuleName_Block_Product_View</product_view> 
                </rewrite>
            </review>            
            <adminhtml>
                <rewrite>
                    <review_edit_form>NameSpace_ModuleName_Block_Review_Edit_Form</review_edit_form> 
                </rewrite>
                <rewrite>
                    <review_add_form>NameSpace_ModuleName_Block_Review_Add_Form</review_add_form> 
                </rewrite>
            </adminhtml>
            <page>
                <rewrite>
                    <html_pager>NameSpace_ModuleName_Block_Page_Html_Pager</html_pager> 
                </rewrite>
            </page>
        </blocks>
        <models>
            <review_resource>
                <rewrite>
                  <review>NameSpace_ModuleName_Model_Resource_Review</review>
                </rewrite>
            </review_resource>
             <review_resource>
                <rewrite>  
                  <review_collection>NameSpace_ModuleName_Model_Resource_Review_Collection</review_collection>
                </rewrite>
            </review_resource>
            <Review>
                <class>NameSpace_ModuleName_Model</class>
            </Review>
        </models>
        <events>
            <review_save_after>
                <observers>
                    <NameSpace_ModuleName>
                        <type>singleton</type>
                        <class>NameSpace_ModuleName_Model_Observer</class>
                        <method>notifyRecipient</method>
                    </NameSpace_ModuleName>
                </observers>
            </review_save_after>
        </events>
        <template>
            <email>
                <review_email_notification_optionamespace_email_template tranamespacelate="label" module="review">
                    <label>Product Review Notification</label>
                    <file>product_review_notification.html</file>
                    <type>html</type>
                </review_email_notification_optionamespace_email_template>
            </email>
        </template>
    </global>
</config>

And I place file the following path: Local/Namespace/ModuleName/Block/Product/View.php

with class name extended like this: class Namespace_ModuleName_Block_Product_View extends Mage_Catalog_Block_Product_View

But it would not extend it for some reason. Its not cache, and the rest of the module works fine.

Please help dont know what to try.

Thanks,

2 Answers 2

0

I guess your class should extend Mage_Review_Block_Product_View.

1
  • It doesn't even pointing at the View class file. The problem is somewhere in config.xml, I think it might be rewrite path that is not correct. Oct 29, 2018 at 15:06
0
<global>    
    <blocks>
        <review>
            <rewrite>              
                <product_view>NameSpace_ModuleName_Block_Product_View</product_view> 
            </rewrite>
        </review> 
    </blocks>
<global> 

NameSpace/ModuleName/Block/Product/View.php

class Namespace_ModuleName_Block_Product_View extends Mage_Review_Block_Product_View
{
    //your code here
}
22
  • I got same thing, Tried it with Mage_Review_Block_Product_View as well. but its not pointing to rewrite class at all. Something wrong in config.xml i think. Oct 29, 2018 at 15:15
  • You module is working correctly ? try to clean the cache
    – PЯINCƎ
    Oct 29, 2018 at 15:15
  • I did, removed cache directory. Oct 29, 2018 at 15:16
  • What about your module ?
    – PЯINCƎ
    Oct 29, 2018 at 15:18
  • Works fine, I have multiple block classes rewrite all pooling and pointing fine. Oct 29, 2018 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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