Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass seperators #3

Open
clicktrend opened this issue Jun 21, 2016 · 2 comments
Open

How to pass seperators #3

clicktrend opened this issue Jun 21, 2016 · 2 comments

Comments

@clicktrend
Copy link

How can I pass parameters like "field separator" and "multiple value separator"?

@psapoznik
Copy link

Hello, you found a solution?

@cedricblondeau
Copy link
Owner

cedricblondeau commented Sep 13, 2016

It's currently not supported by this module.

To specify a different field separator, you may want to take a look at Model/Import.php file : https://github.com/cedricblondeau/magento2-module-catalog-import-command/blob/master/Model/Import.php#L73.

\Magento\ImportExport\Model\Import\Source\CsvFactory builds a Magento\ImportExport\Model\Import\Source\Csv object.
Source\Csv constructor takes delimiter and enclosure parameters (see: https://github.com/magento/magento2/blob/develop/app/code/Magento/ImportExport/Model/Import/Source/Csv.php#L41).

So, I guess you could do something like this:

$csvSource = $this->csvSourceFactory->create(
  [
    'file' => $pathInfo['basename'],
    'directory' => $this->readFactory->create($pathInfo['dirname']),
    'delimiter' => ';',
    'enclosure' => '|'
  ]
);
$validate = $this->importModel->validateSource($csvSource);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants