2013-03-10 157 views
0

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

目前它确实有效,但只显示我的自定义字段;另一个失败。如果我将标记放在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> 

回答

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> 
+0

这就是我所做的,首先,但随后请求字段集没有出现.. :( – Ortix92 2013-03-10 16:18:48

+0

@ Ortix92也许是因为标签失踪了字段集与再试一次吗?代码我写的 – 2013-03-10 16:40:20

+0

仍然没有。它没有出现在源代码中(没有感到惊讶) – Ortix92 2013-03-10 16:55:26

相关问题