From e29a6ff9d4d4d6d41423374d92ac9ab881567732 Mon Sep 17 00:00:00 2001 From: Hamilton Wang Date: Tue, 26 Jun 2018 15:57:53 +0800 Subject: [PATCH 01/10] add in category import by css --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 20fba28..6eea3b3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Demo module for calling FireGento_FastSimpleImport via command line Installation Instructions with Composer --------------------------------------------- - composer require firegento/fastsimpleimportdemo + composer require sereneum/fastsimpleimportdemo bin/magento module:enable FireGento_FastSimpleImportDemo bin/magento setup:upgrade @@ -16,8 +16,8 @@ Installation Instructions with Composer Installation Instructions with Composer(Master Branch) --------------------------------------------- - composer config repositories.firegento_fastsimpleimportdemo vcs https://github.com/firegento/FireGento_FastSimpleImport2_Demo - composer require firegento/fastsimpleimportdemo dev-master + composer config repositories.firegento_fastsimpleimportdemo vcs https://github.com/sereneum/FireGento_FastSimpleImport2_Demo + composer require sereneum/fastsimpleimportdemo dev-master bin/magento module:enable FireGento_FastSimpleImportDemo bin/magento setup:upgrade @@ -49,6 +49,11 @@ Installation Instructions with Composer(Master Branch) ### Import customers `bin/magento fastsimpleimportdemo:customers:import` +### Import products from CSV File:(currently building) +`bin/magento fastsimpleimportdemo:customers:importcsv` + + + ### Delete all customers: `bin/magento fastsimpleimportdemo:customers:deleteall` From e281798f95d749130f78073150159ba4540f93da Mon Sep 17 00:00:00 2001 From: Hamilton Wang Date: Tue, 26 Jun 2018 15:58:33 +0800 Subject: [PATCH 02/10] typo --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6eea3b3..2182478 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,6 @@ Installation Instructions with Composer(Master Branch) ### Import customers `bin/magento fastsimpleimportdemo:customers:import` -### Import products from CSV File:(currently building) -`bin/magento fastsimpleimportdemo:customers:importcsv` - ### Delete all customers: @@ -62,3 +59,5 @@ Installation Instructions with Composer(Master Branch) ### Import Categories: `bin/magento fastsimpleimportdemo:category:import` +### Import products from CSV File:(currently building) +`bin/magento fastsimpleimportdemo:customers:importcsv` From b5843d081db40d9fc2c518c539b75b9a221ed877 Mon Sep 17 00:00:00 2001 From: Hamilton Wang Date: Tue, 26 Jun 2018 15:59:02 +0800 Subject: [PATCH 03/10] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2182478..2620e1d 100644 --- a/README.md +++ b/README.md @@ -60,4 +60,4 @@ Installation Instructions with Composer(Master Branch) `bin/magento fastsimpleimportdemo:category:import` ### Import products from CSV File:(currently building) -`bin/magento fastsimpleimportdemo:customers:importcsv` +`bin/magento fastsimpleimportdemo:category:importcsv` From 001550ba2f9fbacb3b86610995ea34533fd22e23 Mon Sep 17 00:00:00 2001 From: HamiltonWang Date: Wed, 27 Jun 2018 06:41:46 +0800 Subject: [PATCH 04/10] add category csv import --- .../Command/Category/ImportCategoryCsv.php | 103 ++++++++++++++++++ etc/di.xml | 2 +- 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 Console/Command/Category/ImportCategoryCsv.php diff --git a/Console/Command/Category/ImportCategoryCsv.php b/Console/Command/Category/ImportCategoryCsv.php new file mode 100644 index 0000000..2a1e51e --- /dev/null +++ b/Console/Command/Category/ImportCategoryCsv.php @@ -0,0 +1,103 @@ +readFactory = $readFactory; + + $this->directory_list = $directory_list; + } + + protected function configure() + { + + $this->setName('fastsimpleimportdemo:category:importcsv') + ->setDescription('Import Category from CSV'); + $this->setBehavior(Import::BEHAVIOR_ADD_UPDATE); + $this->setEntityCode('catalog_category'); + + parent::configure(); + } + + /** + * @return array + */ + protected function getEntities() + { + /* + $data[] = array( + '_root' => 'Default Category', + '_category' => 'FireGento TestCategory', + 'description' => 'Test2', + 'is_active' => '1', + 'include_in_menu' => '1', + 'meta_description' => 'Meta Test', + 'available_sort_by' => 'position', + 'default_sort_by' => 'position', + 'is_anchor' => '1' + ); + */ + + $csvIterationObject = $this->readCSV(); + $data = array(); + // Do mapping here: + foreach($csvIterationObject as $row){ + $data[] = $row; + } + // Mapping end + //var_dump($data); + //die(); + return $data; + } + + protected function readCSV() + { + $csvObj = Reader::createFromString($this->readFile(static::IMPORT_FILE)); + $csvObj->setDelimiter(','); + $results = $csvObj->fetchAssoc(); + return $results; + + } + + protected function readFile($fileName) + { + $path = $this->directory_list->getRoot(); + $directoryRead = $this->readFactory->create($path); + return $directoryRead->readFile($fileName); + } +} \ No newline at end of file diff --git a/etc/di.xml b/etc/di.xml index e13029a..77cbdeb 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -21,7 +21,7 @@ FireGento\FastSimpleImportDemo\Console\Command\Customer\ImportCustomer FireGento\FastSimpleImportDemo\Console\Command\Category\ImportCategory - + FireGento\FastSimpleImportDemo\Console\Command\Category\ImportCategoryCsv FireGento\FastSimpleImportDemo\Console\Command\Category\ImportCategoryMultiStoreView From d772998f75e770c815372124a66fa4bf435e3c4f Mon Sep 17 00:00:00 2001 From: Hamilton Wang Date: Wed, 27 Jun 2018 07:49:49 +0800 Subject: [PATCH 05/10] change to sereneum --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 96b4be4..eb96eb7 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "firegento/fastsimpleimportdemo", + "name": "sereneum/fastsimpleimportdemo", "description": "Wrapper for Magento2 ImportExport functionality, which imports products and customers from arrays", "homepage": "https://github.com/magento-hackathon/FireGento_FastSimpleImport2_Demo", "require": { @@ -20,7 +20,7 @@ "registration.php" ], "psr-4": { - "FireGento\\FastSimpleImportDemo\\": "" + "Sereneum\\FastSimpleImportDemo\\": "" } } } From d3f9fa5439b5879281631e814cd0f638dbac4234 Mon Sep 17 00:00:00 2001 From: HamiltonWang Date: Wed, 27 Jun 2018 07:51:57 +0800 Subject: [PATCH 06/10] composer --- composer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 96b4be4..e866ef3 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "firegento/fastsimpleimportdemo", + "name": "sereneum/fastsimpleimportdemo", "description": "Wrapper for Magento2 ImportExport functionality, which imports products and customers from arrays", "homepage": "https://github.com/magento-hackathon/FireGento_FastSimpleImport2_Demo", "require": { @@ -10,6 +10,10 @@ "type": "magento2-module", "license": "GPL-3.0", "authors": [ + { + "name": "Team Sereneum", + "email": "hamilton@aiart.io" + }, { "name": "Team FireGento", "email": "team@firegento.com" @@ -20,7 +24,7 @@ "registration.php" ], "psr-4": { - "FireGento\\FastSimpleImportDemo\\": "" + "Sereneum\\FastSimpleImportDemo\\": "" } } } From 44573e2f48acaa93f69d8fab4f3c764f526fbb40 Mon Sep 17 00:00:00 2001 From: HamiltonWang Date: Wed, 27 Jun 2018 09:17:52 +0800 Subject: [PATCH 07/10] test --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2620e1d..1cf3ba7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ Demo module for calling FireGento_FastSimpleImport via command line - Installation Instructions with Composer --------------------------------------------- From 3f24a3f04ed57b5628b59dcb1c5de8890db73ee2 Mon Sep 17 00:00:00 2001 From: HamiltonWang Date: Wed, 27 Jun 2018 10:38:58 +0800 Subject: [PATCH 08/10] right version --- Console/Command/Category/ImportCategoryCsv.php | 2 -- Console/Command/Product/DeleteAll.php | 3 --- README.md | 7 ++++--- composer.json | 6 +++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Console/Command/Category/ImportCategoryCsv.php b/Console/Command/Category/ImportCategoryCsv.php index 2a1e51e..5e3d3ed 100644 --- a/Console/Command/Category/ImportCategoryCsv.php +++ b/Console/Command/Category/ImportCategoryCsv.php @@ -34,10 +34,8 @@ public function __construct( \Magento\Framework\App\Filesystem\DirectoryList $directory_list ) { - parent::__construct($objectManagerFactory); - $this->readFactory = $readFactory; $this->directory_list = $directory_list; diff --git a/Console/Command/Product/DeleteAll.php b/Console/Command/Product/DeleteAll.php index 527ae7d..93e0e7a 100644 --- a/Console/Command/Product/DeleteAll.php +++ b/Console/Command/Product/DeleteAll.php @@ -14,9 +14,6 @@ class DeleteAll extends AbstractImportCommand { - - - protected function configure() { $this->setName('fastsimpleimportdemo:products:deleteall') diff --git a/README.md b/README.md index 1cf3ba7..ed9ae64 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,11 @@ Demo module for calling FireGento_FastSimpleImport via command line + Installation Instructions with Composer --------------------------------------------- - composer require sereneum/fastsimpleimportdemo + composer require firegento/fastsimpleimportdemo bin/magento module:enable FireGento_FastSimpleImportDemo bin/magento setup:upgrade @@ -15,8 +16,8 @@ Installation Instructions with Composer Installation Instructions with Composer(Master Branch) --------------------------------------------- - composer config repositories.firegento_fastsimpleimportdemo vcs https://github.com/sereneum/FireGento_FastSimpleImport2_Demo - composer require sereneum/fastsimpleimportdemo dev-master + composer config repositories.firegento_fastsimpleimportdemo vcs https://github.com/firegento/FireGento_FastSimpleImport2_Demo + composer require firegento/fastsimpleimportdemo dev-master bin/magento module:enable FireGento_FastSimpleImportDemo bin/magento setup:upgrade diff --git a/composer.json b/composer.json index e866ef3..b97097b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "sereneum/fastsimpleimportdemo", + "name": "firegento/fastsimpleimportdemo", "description": "Wrapper for Magento2 ImportExport functionality, which imports products and customers from arrays", "homepage": "https://github.com/magento-hackathon/FireGento_FastSimpleImport2_Demo", "require": { @@ -11,7 +11,7 @@ "license": "GPL-3.0", "authors": [ { - "name": "Team Sereneum", + "name": "Team firegento", "email": "hamilton@aiart.io" }, { @@ -24,7 +24,7 @@ "registration.php" ], "psr-4": { - "Sereneum\\FastSimpleImportDemo\\": "" + "firegento\\FastSimpleImportDemo\\": "" } } } From bb9eb951ba8d5c2b80edb9ecc152d538771294fa Mon Sep 17 00:00:00 2001 From: HamiltonWang Date: Wed, 27 Jun 2018 10:45:37 +0800 Subject: [PATCH 09/10] change sequence --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index b97097b..e1bf936 100644 --- a/composer.json +++ b/composer.json @@ -10,13 +10,13 @@ "type": "magento2-module", "license": "GPL-3.0", "authors": [ - { - "name": "Team firegento", - "email": "hamilton@aiart.io" - }, { "name": "Team FireGento", "email": "team@firegento.com" + }, + { + "name": "Team AI Art", + "email": "hamilton@aiart.io" } ], "autoload": { From f3e7698b9fa270c95d4253b15b367d543c6b693b Mon Sep 17 00:00:00 2001 From: HamiltonWang Date: Wed, 27 Jun 2018 10:51:43 +0800 Subject: [PATCH 10/10] typo --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e1bf936..5e06e3a 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "registration.php" ], "psr-4": { - "firegento\\FastSimpleImportDemo\\": "" + "Firegento\\FastSimpleImportDemo\\": "" } } }