1

我正在尝试在选项卡中显示 Magento 产品库存信息和 Magento 产品价格信息Description

我复制了以下代码: 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 中显示股票和价格信息,但在 .phtml 中没有显示任何内容description.phtml

有什么建议吗?

4

1 回答 1

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>
于 2013-01-06T16:42:04.317 回答