tulparstudyo / sw-xlsx
Aimeos sw-xlsx extension Swordbros
Installs: 21
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 0
Type:aimeos-extension
Requires
- php: ~7.1
- composer/installers: ^1.0
This package is auto-updated.
Last update: 2024-10-29 06:12:29 UTC
README
Product Import & Export for Aimeos
console command
php artisan aimeos:jobs "product/export/xlsx" "default"
php artisan aimeos:jobs "product/import/xlsx" "default"
Example of using on the Laravel Controller
// Export xlsx file
<?php
$Xlsx = new \Aimeos\Controller\Jobs\Product\Export\Xlsx\Standard($this->get('context'), $this->get('aimeos'));
$files = $Xlsx->run();
if($files){
$file_path = $files[0];
header('Content-Type: application/download');
header("Content-Disposition: attachment; filename=".$Xlsx->getXlsxFilename(1));
header("Pragma: no-cache");
header("Expires: 0");
readfile($file_path);
die();
}
?>
// Import xlsx file
$location = $config->get( 'client/product/import/xlsx/location' );
$file_name = 'product-import-1.xlsx';
$file_path = $location .'/'.$file_name;
if($files = (array) $this->getView()->request()->getUploadedFiles()){
foreach($files as $file ){
$file->moveTo($file_path);
}
$Xlsx = new \Aimeos\Controller\Jobs\Product\Import\Xlsx\Standard($context, $this->getAimeos());
$Xlsx->run();
}
$context->getSession()->set( 'info', [$context->getI18n()->dt( 'admin', 'Items imported successfully' )] );
return $this->redirect( 'product', 'search');