framework = $framework; parent::__construct(); } protected function configure(): void { $this ->setName(self::$defaultName) ->setDescription('Search Shopware products by SKU') ->addOption('short','s',InputOption::VALUE_NONE, 'Short result: Only show name and basic product infos') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $this->framework->initialize(); $io = new SymfonyStyle($input, $output); $io->title('Shopware products search by SKU'); $strSku = $io->ask('Enter SKU to search for'); /** @var Shopware $Shopware */ $Shopware = System::getContainer()->get(Shopware::class); if (($Products = $Shopware->getProductsForSku($strSku,true, $input->getOption('short') ? true : false)) !== false) { $cloner = new VarCloner(); $dumper = new CliDumper(); if ($Products->total) { $dumper->dump(($cloner->cloneVar($Products->data))); } $io->success(sprintf('Found %s product(s)',$Products->total)); return self::SUCCESS; } $io->error('Could not retrieve products by SKU'); return self::FAILURE; } }