0

For some reason the layout file of my module stopped working, please help!

This is the module's layout file at ...

\app\design\frontend\rwd\default\layout\productcomment.xml

<layout>
   <catalog_product_view>
      <reference name="product.info">
          <block type="catalog/product_view_attributes" name="product.comment" as="additional" template="productcomment/productcomment.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Product Comments</value></action>
          </block>
      </reference>
   </catalog_product_view>
</layout>

The same block in catalog.xml in the same directory works well (COMMENTED LINES):

<catalog_product_view translate="label">
    <label>Catalog Product View (Any)</label>
    <!-- Mage_Catalog -->
    <reference name="content">
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
                <block type="core/text_list" name="product.info.media.after" as="after" />
            </block>
            <block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
                <label>Alert Urls</label>
            </block>

            <action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>

            <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml">
                <action method="setColumnCount"><columns>6</columns></action>
                <action method="setItemLimit"><type>upsell</type><limit>6</limit></action>
            </block>

            <block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />


            <!--<block type="catalog/product_view_attributes" name="product.comments" as="additional" template="productcomment/productcomment.phtml">
                <action method="setTitle" translate="value"><value>Product Comments</value></action>
            </block>-->

config.xml

<frontend>
    <layout>
        <updates>
            <productcomment module="Cpstest_ProductComment">
                <file>productcomment.xml</file>  
                <file>adminproductcomment.xml</file>                                                                           
            </productcomment>
        </updates>
    </layout>
</frontend>
  • I think your file should be inside folder. like - app\design\frontend\rwd\default\layout\productcomment\productcomment.xml... Because you mentioned it in your template path. – Abhishek Panchal Mar 21 '17 at 21:40
  • Have you flushed the cache? – Colin Murphy Mar 21 '17 at 21:52
  • Thanks guys for your replies. Yes, I flushed the cache and tried to put in the directory as well, but again it doesn't work. – bestwebdevs Mar 21 '17 at 22:11
  • Also tried this code, which also didn't work: <layout> <catalog_product_view> <reference name="content"> <reference name="product.info.media"> <reference name="product.info.additional"> <block type="catalog/product_view_attributes" ...... – bestwebdevs Mar 21 '17 at 22:12
1

The reason it didn't work was the config.xml file, where I had this:

    <config>
    <frontend>
      <layout>
        <updates>
            <productcomment module="Cpstest_ProductComment">
                <file>productcomment.xml</file>
                <file>adminproductcomment.xml</file>                                       
            </productcomment>
        </updates>
       </layout>
       .........

I removed the second file line and changed it to:

    <config>
    <frontend>
      <layout>
        <updates>
            <productcomment module="Cpstest_ProductComment">
                <file>productcomment.xml</file>                                     
            </productcomment>
        </updates>
       </layout>
       .........

and the module's layout file started to work properly. Hope this will help someone, I spent days on this issue.

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.