2012-07-15 36 views
-1

因爲它是用於文本框的,所以我不確定數組應該如何工作。如何在Magento中爲system.xml中的文本框使用<source_model>?

這失敗了。

public function getDefault_dailymatches() 
{ 
    return array(
     array('value' => 0, 'label' => Mage::helper()->__('First item')), 
     array('value' => 1, 'label' => Mage::helper()->__('Second item')), 
     array('value' => 2, 'label' => Mage::helper()->__('third item')), 
    // and so on... 
    );  
} 

這也失敗了。

public function getDefault_dailymatches() 
{ 
    $default = 100; 
    return $default; 
} 

回答

0

我通過爲明顯的默認文本變量搜索Magento.zip找到了答案了自己。

將此添加到​​3210之間的<config></config>標籤。

<default> 
    <showdown> <!-- section --> 
     <dagroup> <!-- group --> 
      <dailymatches>1</dailymatches> 
      <maxmatchvotes>100</maxmatchvotes> 
      <field>default value</field> 
      <!-- <blah><![CDATA[<strong>html tags</strong>]]></blah> 
      <blah2><![CDATA[[email protected]]]></blah2> --> 
     </dagroup> 
    </showdown>   
</default> 
+1

這與你最初的要求有點不同。 – 2012-07-15 11:52:05

+0

不,不是。你看過問題標題了嗎? _我如何使用 **爲Magento中的文本框輸入system.xml?_我想爲我的問題指定的texbox創建一個默認值。如果不需要'',你應該告訴我。 Magento不遵循POLS規則並不是我的錯。 – desbest 2012-07-15 11:58:37

相關問題