0

我正在尝试修改 hikashop 的 XML 文件,以便添加一个额外的下拉列表,允许我选择某些类型和值,这些类型和值稍后将由 php 文件解析。归结为我想向菜单项添加一个额外的请求,而我知道这样做的唯一方法是在 XML 文件中添加一个请求字段。

目前它确实有效,但只显示我的自定义字段;另一个丢失了。如果我将标签放在 fieldset 标签内,则该功能将不再起作用。

这是我的xml文件:

    <?xml version="1.0" encoding="utf-8"?>
<metadata>
    <state>
        <name>Product page</name>
        <params addpath="/components/com_hikashop/params">
            <param name="product_id" type="selectproduct" default="0" label="Select a product" description="Select here the product to display for the current link" />
    </params>
</state>
<layout title="COM_HIKASHOP_PRODUCT_FORM_VIEW_DEFAULT_TITLE">
    <message></message>
</layout>
<fields name="params" addfieldpath="/components/com_hikashop/fields">
    <fieldset name="basic" label="Select a product">
        <field
            id="product_id"
            name="product_id"
            type="selectproduct"
            label="Select a product"
            description="Select here the product to display for the current link"
                            />


    </fieldset>


</fields>

<fields name="request">
    <fieldset name="request">
        <field
            name="viewType"
            type="list"
            label="Type of Product"
            description="Select the type of product to grab the correct template"
            default="2"
        >
            <option value="1">Brace</option>
            <option value="2">Shoe</option>
            <option value="3">misc</option>
        </field>
    </fieldset>

</fields>

4

1 回答 1

1

您的 xml 结构不正确。所有参数都应该在<fields>标签内,但这样的标签只能有一个,所有参数都应该嵌套在标签内。所以字段部分应该是这样的:

<fields name="params" addfieldpath="/components/com_hikashop/fields">
    <fieldset name="basic" label="Select a product">
        <field
            id="product_id"
            name="product_id"
            type="selectproduct"
            label="Select a product"
            description="Select here the product to display for the current link"
                            />
        <field
            name="viewType"
            type="list"
            label="Type of Product"
            description="Select the type of product to grab the correct template"
            default="2"
        >
            <option value="1">Brace</option>
            <option value="2">Shoe</option>
            <option value="3">misc</option>
        </field>
    </fieldset>
</fields>
于 2013-03-10T16:06:11.493 回答