2013-03-10 154 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

相關問題