Skip to content
/ sw-xlsx Public
forked from tulparstudyo/sw-xlsx

Product Import & Export for Aimeos

Notifications You must be signed in to change notification settings

salem/sw-xlsx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sw-xlsx

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');

image

About

Product Import & Export for Aimeos

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%