diff --git a/.docker/magento/HelperModule/Sequra/Helper/Console/Setup.php b/.docker/magento/HelperModule/Sequra/Helper/Console/Setup.php new file mode 100644 index 0000000..e74aaa0 --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/Console/Setup.php @@ -0,0 +1,68 @@ +setName(self::NAME) + ->setDescription('Setup data for quick testing'); + parent::configure(); + } + /** + * Execute command. + * + * @param InputInterface $input InputInterface + * @param OutputInterface $output OutputInterface + * + * @return int 0 if everything went fine, or an exit code + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); + $customerRepository = $objectManager->create(\Magento\Customer\Api\CustomerRepositoryInterface::class); + + $customer = $customerRepository->getById(1); + $customer->setLastname('Costello Costello'); + $addresses = $customer->getAddresses(); + if (!empty($addresses)) { + $address = reset($addresses); + $address->setStreet(['Nueva Calle', 'Piso 2']); + $address->setCity('Barcelona'); + $address->setPostcode('08010'); + $address->setCountryId('ES'); + $address->setTelephone('666666666'); + $regionFactory = $objectManager->create(\Magento\Directory\Model\RegionFactory::class); + $region = $regionFactory->create()->loadByName('Barcelona','ES'); + if ($region->getId()) { + $address->setRegionId($region->getId()); + } + } + + $customerRepository->save($customer); + $output->writeln("Dirección actualizada correctamente"); + return 0; + } +} \ No newline at end of file diff --git a/.docker/magento/HelperModule/Sequra/Helper/composer.json b/.docker/magento/HelperModule/Sequra/Helper/composer.json new file mode 100644 index 0000000..65aa57d --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/composer.json @@ -0,0 +1,15 @@ +{ + "name": "sequra/magento2-helper", + "type": "magento2-module", + "autoload": { + "psr-4": { + "Sequra\\Helper\\": "" + } + }, + "authors": [ + { + "name": "Sequra Engineering" + } + ], + "require": {} +} diff --git a/.docker/magento/HelperModule/Sequra/Helper/etc/config.xml b/.docker/magento/HelperModule/Sequra/Helper/etc/config.xml new file mode 100644 index 0000000..48c6d8f --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/etc/config.xml @@ -0,0 +1,3 @@ + + + diff --git a/.docker/magento/HelperModule/Sequra/Helper/etc/crontab.xml b/.docker/magento/HelperModule/Sequra/Helper/etc/crontab.xml new file mode 100644 index 0000000..0614ceb --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/etc/crontab.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.docker/magento/HelperModule/Sequra/Helper/etc/di.xml b/.docker/magento/HelperModule/Sequra/Helper/etc/di.xml new file mode 100644 index 0000000..e84bdf2 --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/etc/di.xml @@ -0,0 +1,11 @@ + + + + + + + Sequra\Helper\Console\Setup + + + + diff --git a/.docker/magento/HelperModule/Sequra/Helper/etc/events.xml b/.docker/magento/HelperModule/Sequra/Helper/etc/events.xml new file mode 100644 index 0000000..bfb5e96 --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/etc/events.xml @@ -0,0 +1,3 @@ + + + diff --git a/.docker/magento/HelperModule/Sequra/Helper/etc/module.xml b/.docker/magento/HelperModule/Sequra/Helper/etc/module.xml new file mode 100644 index 0000000..9df991e --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/etc/module.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.docker/magento/HelperModule/Sequra/Helper/registration.php b/.docker/magento/HelperModule/Sequra/Helper/registration.php new file mode 100644 index 0000000..d42ec11 --- /dev/null +++ b/.docker/magento/HelperModule/Sequra/Helper/registration.php @@ -0,0 +1,9 @@ +