Magento将产品信息添加到“更多信息”选项卡

时间:2013-01-06 16:29:36

标签: php magento tabs product

我想在标签Description中显示Magento产品库存信息和Magento产品价格信息。

我复制了以下代码: app/design/frontend/default/theme/template/catalog/product/view.phtml

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

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

这会在view.phtml上显示股票和价格信息,但description.phtml中没有显示任何内容。

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

问题是product_type_data阻止是product.info的孩子(实际上是你复制的地方),而不是description阻止。

那么您需要做的是将以下代码添加到主题的local.xml文件中:

<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>
相关问题