Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将左侧边栏中的自定义选项卡添加到magento模块管理部分的自定义页面?_Php_Magento_Magento 1.7 - Fatal编程技术网

Php 如何将左侧边栏中的自定义选项卡添加到magento模块管理部分的自定义页面?

Php 如何将左侧边栏中的自定义选项卡添加到magento模块管理部分的自定义页面?,php,magento,magento-1.7,Php,Magento,Magento 1.7,我对Magento非常陌生,4天前刚开始使用Magento,但我的任务是开发Magento扩展。所以我在网上阅读并创作它 现在的问题是,我想添加一个自定义的左侧边栏选项卡,就像在System->Configuration下一样 我试了很多,但没有成功。请帮帮我 这是我的config.xml <?xml version="1.0"?> <config> <!-- turn on our module, required for install support --&g

我对
Magento
非常陌生,4天前刚开始使用Magento,但我的任务是开发
Magento扩展。所以我在网上阅读并创作它

现在的问题是,我想添加一个自定义的左侧边栏选项卡,就像在
System->Configuration
下一样

我试了很多,但没有成功。请帮帮我

这是我的config.xml

<?xml version="1.0"?>
<config>
<!-- turn on our module, required for install support -->
<modules>
<Gwb_Magecrmsync>
    <version>0.1.0</version>
</Gwb_Magecrmsync>
</modules>
<frontend>
<routers>
    <magecrmsync>
        <use>standard</use>
        <args>
            <module>Gwb_Magecrmsync</module>
            <frontName>magecrmsync</frontName>
        </args>
    </magecrmsync>
</routers>
<layout>
    <updates>
        <magecrmsync>
            <file>adminhtml.xml</file>
        </magecrmsync>
    </updates>
</layout>
</frontend>
<admin>
<routers>
    <magecrmsync>
        <use>admin</use>
        <args>
            <module>Gwb_Magecrmsync</module>
            <frontName>magecrmsync</frontName>
        </args>
    </magecrmsync>
</routers>
</admin>
<adminhtml>
<menu>
    <menu1 translate="title" module="magecrmsync">
        <title>Synchronize</title>
        <sort_order>999</sort_order>
        <children>
            <menuitem1 module="magecrmsync">
                <title>Customers</title>
                <action>magecrmsync/adminhtml_magecrmsync</action>
            </menuitem1>
            <menuitem2 module="magecrmsync">
                <title>Orders</title>
                <action>magecrmsync/adminhtml_magecrmsync</action>
            </menuitem2>
            <menuitem3 module="magecrmsync">
                <title>Products</title>
                <action>magecrmsync/adminhtml_magecrmsync</action>
            </menuitem3>
        </children>
    </menu1>
</menu>
<acl>
    <resources>
        <admin>
            <children>
                <menu1 translate="title" module="magecrmsync">
                    <title>Synchronize</title>
                    <sort_order>999</sort_order>
                    <children>
                        <menuitem1>
                            <title>Customers</title>
                        </menuitem1>
                        <menuitem2>
                            <title>Orders</title>
                        </menuitem2>
                        <menuitem3>
                            <title>Products</title>
                        </menuitem3>
                    </children>
                </menu1>
            </children>
        </admin>
    </resources>
</acl>
</adminhtml>
<global>
<!-- turn on models -->
<models>
    <magecrmsync>
        <class>Gwb_Magecrmsync_Model</class>
        <resourceModel>Magecrmsync_mysql4</resourceModel>
    </magecrmsync>
</models>
<!-- turn on models -->

<!-- turn on database connections -->
<resources>
<!-- setup is needed for automatic installation -->
    <magecrmsync_setup>
        <use>default_setup</use>
    </magecrmsync_setup>
    <magecrmsync_write>
        <use>default_write</use>
    </magecrmsync_write>
    <magecrmsync_read>
        <use>default_read</use>
    </magecrmsync_read>
</resources>

<blocks>
    <magecrmsync>
        <class>Gwb_Magecrmsync_Block</class>
    </magecrmsync>
</blocks>

<helpers>
    <magecrmsync>
        <class>Gwb_Magecrmsync_Helper</class>
    </magecrmsync>
</helpers>

<layout>
    <magecrmsync>
        <file>adminhtml.xml</file>
    </magecrmsync>
</layout>

</global>
</config>

0.1.0
标准
Gwb_Magecrmsync
磁同步
adminhtml.xml
管理
Gwb_Magecrmsync
磁同步
使同步
999
客户
magecrmsync/adminhtml\u magecrmsync
命令
magecrmsync/adminhtml\u magecrmsync
产品
magecrmsync/adminhtml\u magecrmsync
使同步
999
客户
命令
产品
Gwb_Magecrmsync_模型
Magecrmsync_mysql4
默认设置
默认写入
默认读取
Gwb_图像同步块
Gwb_图像同步辅助程序
adminhtml.xml
请告诉我,我在哪里遗漏了一些不允许我在自定义页面左侧添加选项卡的内容。如果我哪里做错了,请纠正我


编辑
这是我的system.xml文件。这是让我添加自定义选项卡下的系统->配置,但我想在我的自定义页面,这是独立的,然后配置菜单

<?xml version="1.0"?>
<config>
<tabs>
    <sidetab translate="label" module="magecrmsync">
        <label>My Custom Tab</label>
        <sort_order>200</sort_order>
    </sidetab>
</tabs>
<sections>
    <sidetab translate="label" module="magecrmsync">
        <class>separator-top</class>
        <label>My Tab</label>
        <tab>sidetab</tab>
        <sort_order>100</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>1</show_in_store>
        <groups>
            <sidetab_option translate="label">
                <label>sysem Tab Options</label>
                <frontend_type>text</frontend_type>
                <sort_order>10</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>
<registration_mode translate="label"> <label>On New User Signup</label>
                        <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                        <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>
                    </registration_mode>
<forget_mode translate="label">
                        <label>Send Email on Forget Password</label>
                        <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                        <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>
                    </forget_mode>
<purchase_mode translate="label">
                        <label>Send Email On Product Purchase</label>
                        <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                        <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>
                    </purchase_mode>
                </fields>
</sidetab_option>
        </groups>
    </sidetab>
</sections>
</config>

我的自定义选项卡
200
分离器顶部
我的账单
侧栏
100
1.
1.
1.
系统选项卡选项
文本
10
1.
1.
1.
关于新用户注册
选择
adminhtml/system\u config\u source\u yesno
1.
1.
1.
1.
忘记密码后发送电子邮件
选择
adminhtml/system\u config\u source\u yesno
1.
1.
1.
1.
发送有关产品购买的电子邮件
选择
adminhtml/system\u config\u source\u yesno
1.
1.
1.
1.

我的控制器代码:


我在上一个答案中快速阅读了您的问题,因此我将用正确的信息添加这个新问题。您需要创建一个文件夹结构,其中选项卡在不同的文件中分开

以下链接解释了如何向现有模块添加选项卡,您可能希望自己搜索更好的文章,因为有足够的信息可以找到:

另一篇关于它的文章:

似乎您正试图在管理控制器中创建一个“左”和“主”块

$this->loadLayout();
$this->_addContent($this->getLayout()->createBlock('form/adminhtml_form_edit'))
            ->_addLeft($this->getLayout()->createBlock('form/adminhtml_form_edit_tabs'));
$this->renderLayout();


class Excellence_Form_Block_Adminhtml_Form_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
{

  public function __construct()
  {
      parent::__construct();
      $this->setId('form_tabs');
      $this->setDestElementId('edit_form'); // this should be same as the form id define above
      $this->setTitle(Mage::helper('form')->__('Product Information'));
  }

  protected function _beforeToHtml()
  {
      $this->addTab('form_section', array(
          'label'     => Mage::helper('form')->__('Item Information'),
          'title'     => Mage::helper('form')->__('Item Information'),
          'content'   => $this->getLayout()->createBlock('form/adminhtml_form_edit_tab_form')->toHtml(),
      ));

      return parent::_beforeToHtml();
  }
}

$this->\u addLeft($this->getLayout()
->createBlock('核心/文本')
->setText(‘左块’);
$block=$this->getLayout()
->createBlock('核心/文本')
->setText(“主块”);
$this->\u addContent($block);

阅读更多@

你能为模块发布你的system.xml吗?我更新了我的代码,请检查itHello@Menno,你能检查我的代码并帮助我吗?你好@Menno,我读了这么多文章,无论在哪里我都能找到窍门,可以将选项卡添加到系统->配置,也可以添加到产品编辑页面和客户编辑页面,但这对我没有帮助,因为我的控制器是不同的,我也把我的控制器的代码。请检查一下。我找到了这篇文章,否则我现在恐怕帮不了你:谢谢@Menno的帮助。我现在正在尝试,并将让您知道我是否能够做到这一点。是的,但在左侧块中,我想添加选项卡,就像在系统->配置下一样。你能指导我做这件事吗?为你试图完成的事情添加一个图像。你想在产品管理员上创建标签吗?我刚刚添加了一个图像,在左侧显示标签,但我希望在自定义页面上的标签不在系统->配置页面下。这有意义吗?选项卡是否包含与系统->配置相同的信息?否,它将包含与我的扩展相关的选项卡。
$this->loadLayout();
$this->_addContent($this->getLayout()->createBlock('form/adminhtml_form_edit'))
            ->_addLeft($this->getLayout()->createBlock('form/adminhtml_form_edit_tabs'));
$this->renderLayout();


class Excellence_Form_Block_Adminhtml_Form_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
{

  public function __construct()
  {
      parent::__construct();
      $this->setId('form_tabs');
      $this->setDestElementId('edit_form'); // this should be same as the form id define above
      $this->setTitle(Mage::helper('form')->__('Product Information'));
  }

  protected function _beforeToHtml()
  {
      $this->addTab('form_section', array(
          'label'     => Mage::helper('form')->__('Item Information'),
          'title'     => Mage::helper('form')->__('Item Information'),
          'content'   => $this->getLayout()->createBlock('form/adminhtml_form_edit_tab_form')->toHtml(),
      ));

      return parent::_beforeToHtml();
  }
}
$this->_addLeft($this->getLayout()
    ->createBlock('core/text')
    ->setText('<h1>Left Block</h1>'));

$block = $this->getLayout()
    ->createBlock('core/text')
    ->setText('<h1>Main Block</h1>');           
    $this->_addContent($block);