1

I'm fairly new in Magento and trying to override a phtml file which is originally in

app/design/frontend/rwd/default/template/catalog/product/view/type/availability/default.phtml

with custom one that I ve created in

app/design/frontend/base/default/template/Pawel/productsub/catalog/product/view/type/availability/default.phtml

In my app/code/local/Pawel/Productsub/etc/config.xml I ve put this:

<config>
...
       <frontend>
            <layout version="0.1.0">
                <PRODUCT_TYPE_simple translate="label" module="catalog">
                    <reference name="product.info">
                        <action method="setTemplate">
                            <template>catalog/product/view/type/availability/default.phtml</template>
                        </action>
                    </reference>
                </PRODUCT_TYPE_simple>
            </layout>
        </frontend>
    ...
    </config>

And this is the layout i'm trying to change app/design/frontend/rwd/default/layout/catalog.xml

 <PRODUCT_TYPE_simple translate="label" module="catalog">
        <label>Catalog Product View (Simple)</label>
        <reference name="product.info">
            <block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="catalog/product/view/type/default.phtml">
                <block type="core/text_list" name="product.info.simple.extra" as="product_type_data_extra" translate="label">
                    <label>Product Extra Info</label>
                </block>
            </block>
            <block type="catalog/product_view_type_simple" name="product.info.availability" as="product_type_availability" template="catalog/product/view/type/availability/default.phtml" />
        </reference>
    </PRODUCT_TYPE_simple>

I will appreciate if someone can help me out and explain a little what I'm doing wrong, it gets me a little nervous already.

1
  1. Don't update the base files app/design/frontend/base/default, you create the same path in your current theme then Magento load the file from the current theme according to the theme fallback system.

  2. Put your layout update in local.xml the exact path: app/design/frontend/{your package}/{your theme}/layout/local.xml and not in config.xml

1

You have added wrong code in your config.xml, you have to add below code there-

<frontend>
    <layout>
        <updates>
           <module_name>
              <file>your_layout_file_name.xml</file>
           </module_name>
        </updates>
    </layout>
</frontend>

Then create your_layout_file_name.xml under your theme's layout directory and add below code there

<?xml version="1.0"?>
<layout version="0.1.0">
    <PRODUCT_TYPE_simple translate="label" module="catalog">
        <reference name="product_type_data">
            <action method="setTemplate">
                <template>pawel/productsub/catalog/product/view/type/availability/default.phtml</template>
            </action>
        </reference>
    </PRODUCT_TYPE_simple>
</layout>
  • hey, thanks for answering i did all you said , i changed the config.xml code and "linked" pawel_productsub.xml, created xml file under app/design/frontend/base/default/layout/pawel_productsub.xml moved my template from pawel/produtsub to pawel_productsub deleted cache, but nothing really changed, its still using the base layout – Pawel Oct 2 '17 at 10:45
  • most welcome, let me know if you face any issue :) – Piyush Oct 2 '17 at 10:47
  • please put these files in your current theme directory as well and check if your Module is enable from admin System -> Configuration -> Advanced – Piyush Oct 2 '17 at 11:09

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.