Jump to content

the import is too slow


/rai

Recommended Posts

I am using the code below to make an import from csv. But today prestashop its functions takes me 40 minutes to 300 products with pictures. Is there any way to optimize it?

function loadProductsPost() {
	$_POST = array (
		'tab' => 'AdminImport',
		'skip' => '1',
		'csv' => 'xxxxx.csv',
		'forceIDs' => '0',
		'match_ref' => '1',
		'convert' => '',
		'entity' => '1',
		'separator' => ';',
		'multiple_value_separator' => ',',
		'iso_lang' => 'es',
		'import' => 'Importar datos CSV',
		'type_value' =>
		array (
			0 => 'category',
			1 => 'name',
			2 => 'description_short',
			3 => 'reference',
			4 => 'ean13',
			5 => 'weight',
			6 => 'wholesale_price',
			7 => 'price_tex',
			8 => 'ecotax',
			9 => 'manufacturer',
			10 => 'image',
		),
	);
}
 
$import = New AdminImportController();
 
loadProductsPost();
 
$import->productImport();
 

function loadCategoriesPost() {
	$_POST = array (
		'tab' => 'AdminImport',
		'skip' => '1',
		'csv' => 'xxxxxx.csv',
		'forceIDs' => '1',
		'convert' => '',
		'entity' => '0',
		'separator' => ';',
		'multiple_value_separator' => ',',
		'iso_lang' => 'es',
		'import' => 'Importar datos CSV',
		'type_value' =>
		array (
			0 => 'id',
			1 => 'active',
			2 => 'name',
			3 => 'parent',
			4 => 'is_root_category',
			5 => 'description',
			6 => 'meta_title',
			7 => 'meta_keywords',
			8 => 'meta_description',
			9 => 'link_rewrite',
			10 => 'image',
		),
	);
}
 
$import = New AdminImportController();
 
loadCategoriesPost();
 
$import->categoryImport();
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...