2011-05-01 17 views
11

क्या यह संभव है (प्रोग्रामिंग या xml कॉन्फ़िगरेशन के माध्यम से) टेक्स्ट फ़ील्ड व्यवस्थापक कॉन्फ़िगरेशन विकल्प के लिए डिफ़ॉल्ट मान है? यदि हां, तो कैसे?Magento - व्यवस्थापक फ़ील्ड के लिए डिफ़ॉल्ट मान

उत्तर

32

आप अपने मॉड्यूल की config.xml फ़ाइल के माध्यम से व्यवस्थापक कॉन्फ़िगरेशन विकल्प में डिफ़ॉल्ट मान जोड़ सकते हैं। व्यवस्थापक कॉन्फ़िगरेशन विकल्प द्वारा, मैं समझता हूं कि आपका मतलब कॉन्फ़िगरेशन सेटिंग्स विकल्प (सिस्टम -> कॉन्फ़िगरेशन) है।

मान लीजिए, आपके पास निम्नलिखित system.xml फ़ाइल है। सिस्टम कॉन्फ़िगरेशन विकल्प जोड़ने के लिए System.xml फ़ाइल आवश्यक है।

<?xml version="1.0" encoding="UTF-8"?> 
<config> 
    <sections>   
     <mysection translate="label" module="mymodule"> 
      <label>My Section</label> 
      <tab>catalog</tab> 
      <frontend_type>text</frontend_type> 
      <sort_order>110</sort_order> 
      <show_in_default>1</show_in_default> 
      <show_in_website>1</show_in_website> 
      <show_in_store>1</show_in_store> 
      <groups> 
       <mygroup translate="label" module="mymodule"> 
        <label>My Group</label> 
        <frontend_type>text</frontend_type> 
        <sort_order>99</sort_order> 
        <show_in_default>1</show_in_default> 
        <show_in_website>1</show_in_website> 
        <show_in_store>1</show_in_store> 
        <fields> 
         <myfield translate="label comment"> 
          <label>My Field</label>       
          <frontend_type>text</frontend_type> 
          <sort_order>1</sort_order> 
          <show_in_default>1</show_in_default> 
          <show_in_website>1</show_in_website> 
          <show_in_store>1</show_in_store> 
         </myfield>      
        </fields> 
       </mygroup> 
      </groups>   
     </mysection>    
    </sections> 
</config> 

अब, व्यवस्थापक विन्यास विकल्प के लिए डिफ़ॉल्ट मान जोड़ने के लिए, आप में config.xml अपने मॉड्यूल के फ़ाइल निम्न लिखने के लिए की जरूरत है।

<default> 
    <mysection> 
     <mygroup>     
      <myfield>My Default Value</myfield>   
     </mygroup>  
    </mysection> 
</default> 

उम्मीद है कि इससे मदद मिलती है।

विस्तार स्पष्टीकरण के लिए, आप उल्लेख कर सकते हैं करने के लिए: - http://alanstorm.com/magento_default_system_configuration_values

+0

यह मेरे लिए काम करने के लिए प्रतीत नहीं होता। मैंने अपने कैश, स्टोरेज कैश, लॉग इन और आउट फ्लश किया है, ब्राउजर कैश साफ़ किया है। डिफ़ॉल्ट काम करने के लिए मुझे और क्या करना चाहिए? – ahnbizcad

0
<default> 
    <catalog><!-- tag of the system.xml section --> 
     <frontend><!-- tag of the system.xml group --> 
      <name_of_your_field>4</name_of_your_field><!-- tag of the system.xml field --> 
     </frontend> 
    </catalog> 
</default> 
संबंधित मुद्दे