gpt4 book ai didi

javascript - Shopware 5,从 Own Plugin 打开 BatchProcess 窗口

转载 作者:行者123 更新时间:2023-11-29 23:54:40 25 4
gpt4 key购买 nike

希望不要拐弯抹 Angular 的要求不要太苛刻。

开始吧:

我在为 Shopware 5 开发自定义插件时遇到问题。我已经有一个工作插件,其中列出了特定条件的订单。现在我想要在这个网格窗口的工具栏中有一个按钮(我已经有了)。

按钮应打开批处理窗口,该窗口已在商店软件的 native “订购”窗口中可用。

问:如何使用我的网格的选定 ID 打开此应用程序?

这是我所拥有的:

[...]
createToolbarButton: function () {
var me = this;
return Ext.create('Ext.button.Button', {
text: 'Batch Processing Orders',
name: 'customBatchProcessButton',
cls: 'secondary',
handler: function () {
me.onClickCustomBatchProcessButton(me);
}
});
},
onClickCustomBatchProcessButton: function(me){
var thisGrid = me.getTransferGrid();
var records = thisGrid.getSelectionModel().getSelection();
console.log("Grid");
console.log(thisGrid);
console.log("records");
console.log(records);
Shopware.app.Application.addSubApplication({
name: 'Shopware.apps.Order',
action: 'batch',
params: {
mode: 'multi',
records: records
}
});
}
[...]

它总是打开订单窗口的普通 View 。 (控制台没有错误)有人有建议吗?那太好了!感谢您的宝贵时间:)

问候

编辑:嘿,谢谢你到目前为止的回复。我设法像这样打开批处理窗口:

me.getView('Shopware.apps.Order.view.batch.Window').create({
orderStatusStore: Ext.create('Shopware.apps.Base.store.OrderStatus').load(),
records: orderRecords,
mode: 'multi'
}).show({});

但现在问题来了,批处理事件没有应用到表单上的按钮上......我仍在尝试错误中。

最佳答案

许多 Shopware ExtJS 子应用程序可以从另一个应用程序执行,并使用某些参数完全按照您尝试的方式执行。不幸的是,我在 Order 插件中看不到任何可能导致预期结果的代码。您可以通过阅读主 Controller 的 init 函数 -> Shopware.apps.Order.controller.Main

查看 Shopware SubApplication 支持的操作/参数例如,来自客户插件的

Shopware.apps.Customer.controller.Main 接受一个操作,就像您正在使用它一样——它正在检查:

if (me.subApplication.action && me.subApplication.action.toLowerCase() === 'detail') {
if (me.subApplication.params && me.subApplication.params.customerId) {
//open the customer detail page with the passed customer id
...

在订单插件中有类似的代码,但它只需要一个订单 ID 并打开相应订单的详细信息页面。它显然没有 batch.Window

您也许能够以某种方式重用此类,但这可能是您需要从实际的 Order 插件改编的大量代码。如果你确实需要这个功能,可以仔细阅读Order插件是如何初始化窗口及其依赖的,并尝试一下。

在这种情况下,我宁愿开发一个轻量级模块(它是后端窗口中的一个框架,仅使用 PHP/Smarty/HTML 的 Controller 和模板 View )

关于javascript - Shopware 5,从 Own Plugin 打开 BatchProcess 窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41961948/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com