在magento 1和magento 2的系统配置设置中调用Phtml文件

时间:2018-11-29 09:57:50

标签: magento

在magento 1和magento 2中的“系统配置”设置中调用Phtml文件。

我需要致电ajax来检查客户是否注册。

检查屏幕快照以更好地理解。

enter image description here

1 个答案:

答案 0 :(得分:0)

I found answer for Magento1:
Just follow below steps :
1) edit system.xml file <sections>
.....
 <groups>
....
 <fields>
 <authentication_notice translate="label" module="customapi">       <frontend_model>customapi/adminhtml_system_config_fieldset_authentication</frontend_model> <help_link>link here</help_link>  <sort_order>0</sort_order>  <show_in_default>1</show_in_default>  <show_in_website>1</show_in_website>   <show_in_store>1</show_in_store> </authentication_notice>
 </fields>


<?php
 2)
class Customplugin_Customapi_Block_Adminhtml_System_Config_Fieldset_Authentication 
    extends Mage_Adminhtml_Block_Abstract
    implements Varien_Data_Form_Element_Renderer_Interface
{
    protected $_template = 'customapi/Authentication.phtml';

    /**
     * Render fieldset html
     *
     * @param Varien_Data_Form_Element_Abstract $element
     * @return string
     */
    public function render(Varien_Data_Form_Element_Abstract $element)
    {
        $elementOriginalData = $element->getOriginalData();
        if (isset($elementOriginalData['help_link'])) {
            $this->setHelpLink($elementOriginalData['help_link']);
        }
        return $this->toHtml();
    }
}

3) create phtml file in app/design/adminhtml/default/default/template/customapi/Authentication.phtml

Now your data will show .

> Blockquote