簡體   English   中英

將字段添加到magento中的自定義模塊管理部分

[英]Adding field to custom module admin section in magento

我已經使用模塊創建者創建了自定義模塊,並且它看起來還不錯,現在我想在其中添加一個新字段,以某種方式我無法做到這一點。我向位於Adminhtml /中的 Form.php文件添加了以下幾行模塊名稱/編輯/標簽

$fieldset->addField('titlenew', 'text', array(
      'label'     => Mage::helper('test')->__('Title New'),
      'class'     => 'required-entry',
      'required'  => true,
      'name'      => 'titlenew',
  ));

出現該字段,但數據未保存。需要幫助。

您需要在與要編輯的實體相關聯的表中添加新列。
將其命名為字段titlenew 並清除緩存。
即使禁用了緩存,ZF也會緩存表架構。

您需要創建一個升級腳本以在db表中添加新列,看看@

Magento –安裝,安裝升級,數據和數據升級腳本

適用於開發人員的Magento:第6部分-Magento設置資源

然后按照@Marius的建議清除緩存

將titlenew更改為titlenew2並將標簽“ Title New”更改為Title New2

$fieldset->addField('titlenew2', 'text', array(
      'label'     => Mage::helper('test')->__('Title New2'),
      'class'     => 'required-entry',
      'required'  => true,
      'name'      => 'titlenew2',
  ));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM