0

我想根据 sku 更新库存。例如

php magento update_inventory --sku&quantity=array(1001,10) --sku&quantity=array(1002,20) --sku&quantity=array(1003,30)

但我不知道如何添加选项/参数?这里用户至少需要提供一对(sku&数量)。为此,我认为我必须使用 ArrayInput 类/InputArgument/InputOption。

你能给出一些解决方案或参考上述要求吗?

4

1 回答 1

0

你看过如何Magento\Setup\Console\Command\AdminUserCreateCommand使用选项吗?看看该代码如何getOptionsListconfigure方法中使用。对于您的用例,您可能需要考虑使用InputOption::VALUE_IS_ARRAY

一个很好的参考将是http://symfony.com/doc/current/components/console/introduction.html#using-command-options

您可能还需要考虑不同的输入格式。例如使用参数而不是选项并在文档中指定格式。

php magento update_inventory 1001:10 1002:20 1003:30
于 2015-05-01T14:28:01.363 回答