Magento add product info to More Info tab

余生颓废 提交于 2019-12-24 14:07:08

问题


I am trying to show Magento product stock information and Magento product price information in the tab Description.

I have copied the following code from: app/design/frontend/default/theme/template/catalog/product/view.phtml

<?php echo $this->getChildHtml('product_type_data') ?>

into: app/design/frontend/default/theme/template/catalog/product/view/description.phtml

This displays the stock and price information on view.phtml, but nothing is shown in description.phtml.

Any suggestion?


回答1:


The problem is that product_type_data block is a child of product.info (from where you actually copied it) and not description block.

So what do you have to do is to add the following code to local.xml file of your theme:

<PRODUCT_TYPE_simple>
    <reference name="product.description">
        <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>
    </reference>
</PRODUCT_TYPE_simple>
<PRODUCT_TYPE_configurable>
    <reference name="product.description">
        <block type="catalog/product_view_type_configurable" name="product.info.configurable" as="product_type_data" template="catalog/product/view/type/default.phtml">
            <block type="core/text_list" name="product.info.configurable.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
</PRODUCT_TYPE_configurable>
<PRODUCT_TYPE_grouped>
    <reference name="product.description">
        <block type="catalog/product_view_type_grouped" name="product.info.grouped" as="product_type_data" template="catalog/product/view/type/grouped.phtml">
            <block type="core/text_list" name="product.info.grouped.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
</PRODUCT_TYPE_grouped>
<PRODUCT_TYPE_virtual>
    <reference name="product.description">
        <block type="catalog/product_view_type_virtual" name="product.info.virtual" as="product_type_data" template="catalog/product/view/type/default.phtml">
            <block type="core/text_list" name="product.info.virtual.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
</PRODUCT_TYPE_virtual>


来源:https://stackoverflow.com/questions/14184156/magento-add-product-info-to-more-info-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!