Shopware 后端新文章选项卡,密钥已发送,值未发送

Shopware backend new article tab, key sent, value not

我的任务是为 shopware 创建简单的插件,以使用新选项卡和其中的几个字段扩展文章。我以某种方式做到了,代码在下面,但我有一个大问题:

在点击保存按钮操作触发文章数据后,ajax 调用,在浏览器的网络部分我可以看到字段键,但没有值。

请求参数如下所示: 名称:布拉布拉 myfield: <--- 问题 类别:一些类别等..

当字段位于原始选项卡中时一切正常。

app.js:

    // {block name="backend/article/application"}
//  {$smarty.block.parent}
//  {include file="backend/article/controller/controller.js"}
// {/block}

型号:

// {block name="backend/article/model/article/fields"}
//{$smarty.block.parent}
    { name: 'madeby', type: 'string' },
    { name: 'columna', type: 'string' },
    { name: 'colona', type: 'string' },
    { name: 'blabla', type: 'string' },
// {/block}

和主要部分window.js:

// {block name="backend/article/view/detail/window"}
// {$smarty.block.parent}
// {namespace name="backend/etsy_attribute/window"}

Ext.define('Shopware.apps.Article.view.detail.Window.etsy_connector.Window', {

    override: 'Shopware.apps.Article.view.detail.Window',

    /**
     * Override creatMainTabPanel method and add your custom tab here.
     * To extend the tab panel this function can be override.
     *
     * @return Ext.tab.Panel
     */
    createMainTabPanel: function () {
        var me = this, result;
        result = me.callParent(arguments);

        me.registerAdditionalTab({
            title: 'Etsy Tab',
            tabConfig: { disabled: false },
            contentFn: function (article, stores, eOpts) {
                eOpts.tab.add({
                    tab:
                        me.etsyTab = Ext.create('Ext.container.Container', {
                        region: 'center',
                        padding: 10,
                        title: 'Etsy Tab',
                        disabled: false,
                        name: 'additional-tab',
                        //cls: Ext.baseCSSPrefix + 'etsy-tab-container',
                        items: [
                            me.createEtsyPanel()
                        ]
                    }),
                    xtype:
                        me.etsyTab,
                    config:
                        me.etsyTab
                });

            },
            scope: me
        });

        //result.add(me.etsyTab);

        return result;
    },

    createEtsyPanel: function () {
        var me = this;

        me.etsyFormPanel = Ext.create('Ext.form.Panel', {
            name: 'etsy-panel',
            bodyPadding: 10,
            autoScroll: true,
            defaults: {
                labelWidth: 155
            },
            items: [
                me.createEtsyFieldSet()
            ]
        });

        return me.detailContainer = Ext.create('Ext.container.Container', {
            layout: 'fit',
            name: 'main',
            title: me.snippets.formTab,
            items: [
                me.etsyFormPanel
            ]
        });
    },

    createEtsyFieldSet: function () {
        //var me = this;

        return Ext.create('Ext.form.FieldSet', {
            layout: 'anchor',
            cls: Ext.baseCSSPrefix + 'article-etsy-field-set',
            defaults: {
                labelWidth: 155,
                anchor: '100%',
                translatable: true,
                xtype: 'textfield'
            },
            title: 'Etsy connection content',
            items: [
                {
                    xtype: 'textfield',
                    name: 'blabla',
                    height: 100,
                    fieldLabel: 'blabla'
                },
                {
                    xtype: 'textfield',
                    name: 'columna',
                    height: 100,
                    fieldLabel: 'columna'
                },
                {
                    xtype: 'textfield',
                    name: 'colona',
                    height: 100,
                    fieldLabel: 'colona'
                },
                {
                    xtype: 'textfield',
                    name: 'madeby',
                    height: 100,
                    fieldLabel: 'madeby'
                }
            ]
        });
    }
});
// {/block}

我的问题是:

为什么我在新标签页中添加的字段请求中没有发送任何值?

谢谢。

您还需要添加控制器来处理您的选项卡。

//{block name="backend/article/controller/detail" append}
Ext.define('Shopware.apps.Article.controller.detail.etsy_connector.Base', {
   override: 'Shopware.apps.Article.controller.Detail',

   onSaveArticle: function(win, article, options) {
       var me = this;

       me.callParent([win, article, options]);

       console.log(me);
       console.log(me.getMainWindow());

       //You need to find your own form
       console.log(me.getMainWindow().detailContainer);
       console.log(me.getMainWindow().detailContainer.getForm().getValues());
       var myVariables = me.getMainWindow().detailContainer.getForm().getValues();

       //Or merge your data with article data
       var params = Ext.merge({}, me.getMainWindow().detailForm.getForm().getValues(), myVariables);

       //Send to your own controller to handle
       Ext.Ajax.request({
           method: 'POST',
           url: '{url controller=EtsyConnector action=save}',
           params: myVariables
       });
    }
});
//{/block}