我正在尝试在选项卡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
中没有显示任何信息。
有什么建议吗?
问题是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>