firebearstudio / importexportfree

Improve default Magento 2 Import / Export features - cron jobs, CSV , XML , JSON , Excel , mapping of any format, Google Sheet, data and price modification, improved speed and a lot more!
https://firebearstudio.com/the-improved-import.html
Open Software License 3.0
180 stars 68 forks source link

SFTP DOES NOT SUPPORT. PLEASE SEE CODE BELOW TO MAKE SFTP TO WORK #7

Closed nagrgk closed 7 years ago

nagrgk commented 8 years ago

step1 : add new file to following location: Firebear\ImportExport\Model\Filesystem\Io => Sftp.php <?php /**

/**

step2 : add test case to Firebear\ImportExport\Test\Unit\Model\Source\Type => SftpTest.php <?php namespace Firebear\ImportExport\Test\Unit\Model\Source\Type;

use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; use Magento\Framework\App\Filesystem\DirectoryList;

class SftpTest extends \PHPUnit_Framework_TestCase { /**

// $this->_ftpMock = $this->getMockBuilder('Firebear\ImportExport\Model\Source\Type\Ftp') // ->setConstructorArgs( // [ // $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface') // ->disableOriginalConstructor() // ->getMock(), // $this->getMockBuilder('Magento\Framework\Filesystem') // ->disableOriginalConstructor() // ->getMock(), // $this->getMockBuilder('Magento\Framework\Filesystem\File\ReadFactory') // ->disableOriginalConstructor() // ->getMock(), // ] // ) // ->setMethods( // [ // 'uploadSource', // '_getSourceClient', // ] // ) // ->getMock(); // // $this->_ftpMock->expects($this->any()) // ->method('_getSourceClient') // ->willReturn($this->_ftpClient);

    $this->_sftpMock->setData('import_source', 'sftp');
    $this->_sftpMock->setData('sftp_file_path', '/public_html/import/products_2_replace.csv');
}

public function testUploadSource()
{
    try {
        $result = $this->_sftpMock->uploadSource();
    } catch (\Exception $e) {
        $result = $e->getMessage();
    }
    $this->assertEquals('/var/www/local-mage2dev.com/magento2/var/import/sftp/products_2_replace.csv', $result);
}

}

step3: add sftp source to Firebear\ImportExport\Model\Source\Type => Sftp.php <?php /**

namespace Firebear\ImportExport\Model\Source\Type;

class Sftp extends AbstractType { /**

step 4: add source types to /Firebear/ImportExport/etc/ => source_types.xml <?xml version="1.0"?>

step5 : change config.xml :

22

step6: add sftp config settings: user should be username, not 'user'

You will be able to define file path during import/export process

this makes sftp available and product import works with sftp.

FIREBEAR:No one using ftp now days and not secure. Please start adding some secure points to module if you build and sell it. We bought it and finally added our own code to work.

[Uploading sftp.zip…]()

biotech commented 7 years ago

Thanks for that piece - we will have look and implement full support of SFTP!

biotech commented 7 years ago

SFTP support added on full version - https://firebearstudio.com/improved-import.html