Logistic
ph2m/logistic
Manages product and stock imports via console commands. Allows creation of custom import/export classes for other data types with configurable file paths and patterns.
Build Tests
Code Quality
Tested on Magento 2.4.8-p3
Recent Test History
Each release is tested against the latest Magento version at that time.
Looking for Contributors
Composer installation fails. Your contribution could help the entire Magento community!
Share This Module's Status
README
Loaded from GitHubPH2M_Logistic
Manage your imports / exports.
Requirements
Magento >= 2.1.0
Installation
composer config repositories.firegento_extendedimport2 vcs https://github.com/firegento/FireGento_ExtendedImport2
composer require ph2m/logistic
bin/magento module:enable FireGento_FastSimpleImport FireGento_ExtendedImport PH2M_Logistic
bin/magento setup:upgrade
Console commands
You can launch the imports by typing the following commands:
# Products import
bin/magento logistic:import:products
# Stocks import
bin/magento logistic:import:stocks
Launch tests
vendor/phpunit/phpunit/phpunit -c dev/tests/unit/phpunit.xml.dist vendor/ph2m/logistic
To do list
- [ ] Complete unit tests
- [ ] Add WS connection type
Add another import
The following steps are for a new import class but they are the same for an export one. Just use export class/folders instead.
- Create a class which extends the
PH2M\Logistic\Model\Import\AbstractImportclass - In this class, add a
codevariable - Add in your
system.xmlthese configurations (replace<code>by yourcodevariable value):-
<code>_enable: aselectwith aMagento\Config\Model\Config\Source\Yesnosource model -
<code>_path: atextfield -
<code>_file_pattern: atextfield -
<code>_archive_path: atextfield
-
- If necessary, override the
columnsToIgnorevariable to ignore some columns - If necessary, override the
columnsToRenamevariable to rename some header columns to real product attributes codes:/** * @var array */ protected $columnsToRename = [ 'columnFromFile' => 'newColumnName' ]; - If necessary, override the
columnsFixedValuevariable to add some fixed values (attribute set if it's not defined in your CSV file for example)
Add a custom object import
If you want to import a custom object (stores from a store locator for example), override the _launchImporter method in your import class.
This method should return an array which has a success and a message (in case of error) value.
Add another export
- Create a class which extends the
PH2M\Logistic\Model\Export\AbstractExport\class - In this class, add a
codevariable - If you don't want to create a file for each exported object, set the
createAFileForEachObjectvariable to false - Override
_getFileNamefunction to set the export file name - Override
_initObjectsToExportfunction to return the objects to export - Add in your
system.xmlthese configurations (replace<code>by yourcodevariable value):-
<code>_enable: aselectwith aMagento\Config\Model\Config\Source\Yesnosource model -
<code>_path: atextfield
-
- XML files are not supported at the moment, if you want to export as XML you have to override the
_exportObjectsfunction and send an empty header to_createAndSendFile
Local import
Local import must be placed in /var directory. You can next setup your import and archive paths like in the distant imports.
Licence
GNU General Public License, version 3 (GPLv3)
Troubleshooting
This file does not contain any data.
I have seen this issue because I was trying to import a product attribute which had a code in camel case, ie MyAttribute. Replace it by my_attribute.
It can also happen if your data has a bad format, ie you're trying to import an array as value.
Special thanks
Special thanks to Firegento and all contributors to the FastSimpleImport extension!
This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.