0

我们将用于测试的 Shopware 5 系统从 5.6.10 升级到 5.7.6

现在控制台命令

hpr:orders:export  

不见了。

这是来自不再官方支持的市场模块 - 问题是是否有一种简单的方法来修补它。

旧安装:

php7.2 ./console |grep hpr
 hpr
  hpr:orders:export                          Starting the export (as defined in the plugin-config) of the orders. Options are mostly the same as the REST-API options.

升级后:

 php7.4 ./console |grep hpr
 (no output)

5.7 的升级指南中,它指出 Symfony 已升级……但没有直接提及与此相关的重大更改。

namespace HPrAutomaticOrderExport\Components;

use Exception;
use Shopware\Commands\ShopwareCommand;
use Shopware\Components\Plugin\ConfigReader;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class CLICommand extends ShopwareCommand
{


    protected function configure()
    {
    $this->setName('hpr:orders:export');
    $this->setDescription('Starting the export (as defined in the plugin-config) of the orders. Options are mostly the same as the REST-API options.');
    $this->addOption('states', null, InputOption::VALUE_OPTIONAL, 'coma seperated list of order-states ids to filter output');
    $this->addOption('statespayment', null, InputOption::VALUE_OPTIONAL, 'coma seperated list of payment-states ids to filter output');
    $this->addOption('range', null, InputOption::VALUE_OPTIONAL, 'date range: startdate,enddate'); //TODO syntax for today - n days would be great!!!!!!
    $this->addOption('start', null, InputOption::VALUE_OPTIONAL, 'start index in list of orders (defaukt is 0, beginning of the list)');
    $this->addOption('limit', null, InputOption::VALUE_OPTIONAL, 'maximal count of orders to export (default is 100)');
    $this->addOption('number', null, InputOption::VALUE_OPTIONAL, 'number of a single order');
    $this->addOption('exportall', null, InputOption::VALUE_OPTIONAL, 'export all orders, ignore states');
    }

该插件已启用:

 php7.4 console sw:plugin:list|grep Order
 | HPrAutomaticOrderExport             | Automatic XML Order-Export Standard                                        
 | 3.7.1   | Windeit Software GmbH    | Yes    | Yes       |

services.xml编辑

    <service id="hp_order_export_command" class="HPrAutomaticOrderExport\Components\CLICommand">
        <tag name="console.command" />
        <argument type="service" id="shopware.plugin.config_reader"/>
        <argument type="service" id="hp_order_export_service"/>
    </service>

更新我们刚刚禁用了这个插件,因为我们真的不需要它——我仍然把它留给更多的读者。

4

2 回答 2

1

基于迈克尔 T 的评论:

将标签更改为

<tag name="console.command" value="hpr:orders:export"/>

并缓存刷新命令再次显示在控制台中。

于 2021-11-17T15:28:35.543 回答
1

升级到 Shopware 5.7.x 后,我也遇到了这个插件的一些问题。

在我的情况下

“在编译容器时,“hp_order_export_service”服务或别名已被删除或内联。您应该将其公开,或者直接停止使用容器并改用依赖注入。”

我在custom/plugins/HPrAutomaticOrderExport/Resources/services.xml下添加<services> 了行<defaults public="true"/>

这有帮助,也许它也会帮助其他人。

于 2022-01-26T09:11:08.423 回答