Magento将产品信息添加到“更多信息"选项卡
我正在尝试在说明
标签中显示Magento产品的库存信息和Magento产品的价格信息.
I am trying to show Magento product stock information and Magento product price information in the tab 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上显示股票和价格信息,但在 description.phtml
中什么也不会显示.
This displays the stock and price information on view.phtml, but nothing is shown in description.phtml
.
有什么建议吗?
问题是 product_type_data
块是 product.info
的子代(您实际复制的位置)它),而不是 description
块.
The problem is that product_type_data
block is a child of product.info
(from where you actually copied it) and not description
block.
因此,您要做的是将以下代码添加到主题的 local.xml
文件中:
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>