Passed
Push — master ( 34494b...39d0af )
by Aimeos
04:11
created

Standard::cleanup()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 12
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 20
rs 9.8666
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2024
6
 * @package Controller
7
 * @subpackage Jobs
8
 */
9
10
11
namespace Aimeos\Controller\Jobs\Product\Import\Csv;
12
13
14
/**
15
 * Job controller for CSV product imports.
16
 *
17
 * @package Controller
18
 * @subpackage Jobs
19
 */
20
class Standard
21
	extends \Aimeos\Controller\Jobs\Common\Product\Import\Csv\Base
22
	implements \Aimeos\Controller\Jobs\Iface
23
{
24
	/** controller/jobs/product/import/csv/name
25
	 * Class name of the used product suggestions scheduler controller implementation
26
	 *
27
	 * Each default job controller can be replace by an alternative imlementation.
28
	 * To use this implementation, you have to set the last part of the class
29
	 * name as configuration value so the controller factory knows which class it
30
	 * has to instantiate.
31
	 *
32
	 * For example, if the name of the default class is
33
	 *
34
	 *  \Aimeos\Controller\Jobs\Product\Import\Csv\Standard
35
	 *
36
	 * and you want to replace it with your own version named
37
	 *
38
	 *  \Aimeos\Controller\Jobs\Product\Import\Csv\Mycsv
39
	 *
40
	 * then you have to set the this configuration option:
41
	 *
42
	 *  controller/jobs/product/import/csv/name = Mycsv
43
	 *
44
	 * The value is the last part of your own class name and it's case sensitive,
45
	 * so take care that the configuration value is exactly named like the last
46
	 * part of the class name.
47
	 *
48
	 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
49
	 * characters are possible! You should always start the last part of the class
50
	 * name with an upper case character and continue only with lower case characters
51
	 * or numbers. Avoid chamel case names like "MyCsv"!
52
	 *
53
	 * @param string Last part of the class name
54
	 * @since 2015.01
55
	 */
56
57
	/** controller/jobs/product/import/csv/decorators/excludes
58
	 * Excludes decorators added by the "common" option from the product import CSV job controller
59
	 *
60
	 * Decorators extend the functionality of a class by adding new aspects
61
	 * (e.g. log what is currently done), executing the methods of the underlying
62
	 * class only in certain conditions (e.g. only for logged in users) or
63
	 * modify what is returned to the caller.
64
	 *
65
	 * This option allows you to remove a decorator added via
66
	 * "controller/jobs/common/decorators/default" before they are wrapped
67
	 * around the job controller.
68
	 *
69
	 *  controller/jobs/product/import/csv/decorators/excludes = array( 'decorator1' )
70
	 *
71
	 * This would remove the decorator named "decorator1" from the list of
72
	 * common decorators ("\Aimeos\Controller\Jobs\Common\Decorator\*") added via
73
	 * "controller/jobs/common/decorators/default" to the job controller.
74
	 *
75
	 * @param array List of decorator names
76
	 * @since 2015.01
77
	 * @see controller/jobs/common/decorators/default
78
	 * @see controller/jobs/product/import/csv/decorators/global
79
	 * @see controller/jobs/product/import/csv/decorators/local
80
	 */
81
82
	/** controller/jobs/product/import/csv/decorators/global
83
	 * Adds a list of globally available decorators only to the product import CSV job controller
84
	 *
85
	 * Decorators extend the functionality of a class by adding new aspects
86
	 * (e.g. log what is currently done), executing the methods of the underlying
87
	 * class only in certain conditions (e.g. only for logged in users) or
88
	 * modify what is returned to the caller.
89
	 *
90
	 * This option allows you to wrap global decorators
91
	 * ("\Aimeos\Controller\Jobs\Common\Decorator\*") around the job controller.
92
	 *
93
	 *  controller/jobs/product/import/csv/decorators/global = array( 'decorator1' )
94
	 *
95
	 * This would add the decorator named "decorator1" defined by
96
	 * "\Aimeos\Controller\Jobs\Common\Decorator\Decorator1" only to the job controller.
97
	 *
98
	 * @param array List of decorator names
99
	 * @since 2015.01
100
	 * @see controller/jobs/common/decorators/default
101
	 * @see controller/jobs/product/import/csv/decorators/excludes
102
	 * @see controller/jobs/product/import/csv/decorators/local
103
	 */
104
105
	/** controller/jobs/product/import/csv/decorators/local
106
	 * Adds a list of local decorators only to the product import CSV job controller
107
	 *
108
	 * Decorators extend the functionality of a class by adding new aspects
109
	 * (e.g. log what is currently done), executing the methods of the underlying
110
	 * class only in certain conditions (e.g. only for logged in users) or
111
	 * modify what is returned to the caller.
112
	 *
113
	 * This option allows you to wrap local decorators
114
	 * ("\Aimeos\Controller\Jobs\Product\Import\Csv\Decorator\*") around the job
115
	 * controller.
116
	 *
117
	 *  controller/jobs/product/import/csv/decorators/local = array( 'decorator2' )
118
	 *
119
	 * This would add the decorator named "decorator2" defined by
120
	 * "\Aimeos\Controller\Jobs\Product\Import\Csv\Decorator\Decorator2"
121
	 * only to the job controller.
122
	 *
123
	 * @param array List of decorator names
124
	 * @since 2015.01
125
	 * @see controller/jobs/common/decorators/default
126
	 * @see controller/jobs/product/import/csv/decorators/excludes
127
	 * @see controller/jobs/product/import/csv/decorators/global
128
	 */
129
130
131
	private ?array $types = null;
132
133
134
	/**
135
	 * Returns the localized name of the job.
136
	 *
137
	 * @return string Name of the job
138
	 */
139
	public function getName() : string
140
	{
141
		return $this->context()->translate( 'controller/jobs', 'Product import CSV' );
142
	}
143
144
145
	/**
146
	 * Returns the localized description of the job.
147
	 *
148
	 * @return string Description of the job
149
	 */
150
	public function getDescription() : string
151
	{
152
		return $this->context()->translate( 'controller/jobs', 'Imports new and updates existing products from CSV files' );
153
	}
154
155
156
	/**
157
	 * Executes the job.
158
	 *
159
	 * @throws \Aimeos\Controller\Jobs\Exception If an error occurs
160
	 */
161
	public function run()
162
	{
163
		$context = $this->context();
164
		$logger = $context->logger();
165
		$date = date( 'Y-m-d H:i:s' );
166
167
		try
168
		{
169
			$errors = 0;
170
			$location = $this->location();
171
			$fs = $context->fs( 'fs-import' );
172
			$site = $context->locale()->getSiteCode();
0 ignored issues
show
Bug introduced by
The method getSiteCode() does not exist on Aimeos\MShop\Locale\Item\Iface. Did you maybe mean getSiteId()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

172
			$site = $context->locale()->/** @scrutinizer ignore-call */ getSiteCode();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
173
174
			foreach( [$location, $location . '/' . $site] as $location )
175
			{
176
				if( $fs instanceof \Aimeos\Base\Filesystem\DirIface && $fs->isDir( $location ) === false ) {
177
					continue;
178
				}
179
180
				foreach( map( $fs->scan( $location ) )->sort() as $filename )
181
				{
182
					$path = $location . '/' . $filename;
183
184
					if( $fs instanceof \Aimeos\Base\Filesystem\DirIface && $fs->isDir( $path ) ) {
185
						continue;
186
					}
187
188
					$errors = $this->import( $path );
189
				}
190
			}
191
192
			/** controller/jobs/product/import/csv/destructive
193
			 * Deletes all products with categories which havn't been updated
194
			 *
195
			 * By default, the product importer only adds new and updates existing
196
			 * products but doesn't delete any products. If you want to remove all
197
			 * products which haven't been updated during the import, then set this
198
			 * configuration option to "true". This will remove all products which
199
			 * are not assigned to any category but keep the ones without categories,
200
			 * e.g. rebate products.
201
			 *
202
			 * @param bool TRUE to delete all untouched products, FALSE to keep them
203
			 * @since 2023.10
204
			 * @see controller/jobs/product/import/csv/backup
205
			 * @see controller/jobs/product/import/csv/domains
206
			 * @see controller/jobs/product/import/csv/location
207
			 * @see controller/jobs/product/import/csv/mapping
208
			 * @see controller/jobs/product/import/csv/max-size
209
			 * @see controller/jobs/product/import/csv/skip-lines
210
			 */
211
			if( $context->config()->get( 'controller/jobs/product/import/csv/destructive', false ) )
212
			{
213
				$count = $this->cleanup( $date );
214
				$logger->info( sprintf( 'Removed %1$s old products', $count ), 'import/csv/product' );
215
			}
216
217
			if( $errors > 0 ) {
218
				$this->mail( 'Product CSV import', sprintf( 'Invalid product lines during import: %1$d', $errors ) );
219
			}
220
		}
221
		catch( \Exception $e )
222
		{
223
			$logger->error( 'Product import error: ' . $e->getMessage() . "\n" . $e->getTraceAsString(), 'import/csv/product' );
224
			$this->mail( 'Product CSV import error', $e->getMessage() . "\n" . $e->getTraceAsString() );
225
			throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() );
226
		}
227
	}
228
229
230
	/**
231
	 * Returns the directory for storing imported files
232
	 *
233
	 * @return string Directory for storing imported files
234
	 */
235
	protected function backup() : string
236
	{
237
		/** controller/jobs/product/import/csv/backup
238
		 * Name of the backup for sucessfully imported files
239
		 *
240
		 * After a CSV file was imported successfully, you can move it to another
241
		 * location, so it won't be imported again and isn't overwritten by the
242
		 * next file that is stored at the same location in the file system.
243
		 *
244
		 * You should use an absolute path to be sure but can be relative path
245
		 * if you absolutely know from where the job will be executed from. The
246
		 * name of the new backup location can contain placeholders understood
247
		 * by the PHP DateTime::format() method (with percent signs prefix) to
248
		 * create dynamic paths, e.g. "backup/%Y-%m-%d" which would create
249
		 * "backup/2000-01-01". For more information about the date() placeholders,
250
		 * please have a look  into the PHP documentation of the
251
		 * {@link https://www.php.net/manual/en/datetime.format.php format() method}.
252
		 *
253
		 * **Note:** If no backup name is configured, the file will be removed!
254
		 *
255
		 * @param integer Name of the backup file, optionally with date/time placeholders
256
		 * @since 2018.04
257
		 * @see controller/jobs/product/import/csv/destructive
258
		 * @see controller/jobs/product/import/csv/domains
259
		 * @see controller/jobs/product/import/csv/location
260
		 * @see controller/jobs/product/import/csv/mapping
261
		 * @see controller/jobs/product/import/csv/max-size
262
		 * @see controller/jobs/product/import/csv/skip-lines
263
		 */
264
		$backup = $this->context()->config()->get( 'controller/jobs/product/import/csv/backup' );
265
		return \Aimeos\Base\Str::strtime( (string) $backup );
266
	}
267
268
269
	/**
270
	 * Checks the given product type for validity
271
	 *
272
	 * @param string|null $type Product type or null for no type
273
	 * @return string New product type
274
	 */
275
	protected function checkType( string $type = null ) : string
276
	{
277
		if( !isset( $this->types ) )
278
		{
279
			$this->types = [];
280
281
			$manager = \Aimeos\MShop::create( $this->context(), 'product/type' );
282
			$search = $manager->filter()->slice( 0, 10000 );
283
284
			foreach( $manager->search( $search ) as $item ) {
285
				$this->types[$item->getCode()] = $item->getCode();
286
			}
287
		}
288
289
		return ( isset( $this->types[$type] ) ? $this->types[$type] : 'default' );
290
	}
291
292
293
	/**
294
	 * Removes all products which have been updated before the given date/time
295
	 *
296
	 * @param string $datetime Date and time in ISO format
297
	 * @return int Number of removed products
298
	 */
299
	protected function cleanup( string $datetime ) : int
300
	{
301
		$count = 0;
302
303
		$manager = \Aimeos\MShop::create( $this->context(), 'product' );
304
		$filter = $manager->filter();
305
		$filter->add( 'product.mtime', '<', $datetime )->add( $filter->make( 'product:has', ['catalog', null] ), '!=', null );
306
		$cursor = $manager->cursor( $filter );
307
308
		while( $items = $manager->iterate( $cursor, ['product' => ['default']] ) )
309
		{
310
			$articles = $items->filter( fn( $item ) => $item->getType() === 'select' )
311
				->getRefItems( 'product', null, 'default' )->flat( 1 );
312
			$count = count( $articles ) + count( $items );
313
314
			$manager->delete( $articles );
315
			$manager->delete( $items );
316
		}
317
318
		return $count;
319
	}
320
321
322
	/**
323
	 * Returns the list of domain names that should be retrieved along with the attribute items
324
	 *
325
	 * @return array List of domain names
326
	 */
327
	protected function domains() : array
328
	{
329
		/** controller/jobs/product/import/csv/domains
330
		 * List of item domain names that should be retrieved along with the product items
331
		 *
332
		 * For efficient processing, the items associated to the products can be
333
		 * fetched to, minimizing the number of database queries required. To be
334
		 * most effective, the list of item domain names should be used in the
335
		 * mapping configuration too, so the retrieved items will be used during
336
		 * the import.
337
		 *
338
		 * @param array Associative list of MShop item domain names
339
		 * @since 2018.04
340
		 * @see controller/jobs/product/import/csv/backup
341
		 * @see controller/jobs/product/import/csv/destructive
342
		 * @see controller/jobs/product/import/csv/location
343
		 * @see controller/jobs/product/import/csv/mapping
344
		 * @see controller/jobs/product/import/csv/max-size
345
		 * @see controller/jobs/product/import/csv/skip-lines
346
		 */
347
		return $this->context()->config()->get( 'controller/jobs/product/import/csv/domains', [] );
348
	}
349
350
351
	/**
352
	 * Returns the position of the "product.code" column from the product item mapping
353
	 *
354
	 * @param array $mapping Mapping of the "item" columns with position as key and code as value
355
	 * @return int Position of the "product.code" column
356
	 * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "product.code" is found
357
	 */
358
	protected function getCodePosition( array $mapping ) : int
359
	{
360
		foreach( $mapping as $pos => $key )
361
		{
362
			if( $key === 'product.code' ) {
363
				return $pos;
364
			}
365
		}
366
367
		throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "product.code" column in CSV mapping found' ) );
368
	}
369
370
371
	/**
372
	 * Returns the product items for the given codes
373
	 *
374
	 * @param array $codes List of product codes
375
	 * @param array $domains List of domains whose items should be fetched too
376
	 * @return \Aimeos\Map Associative list of product codes as key and product items as value
377
	 */
378
	protected function getProducts( array $codes, array $domains ) : \Aimeos\Map
379
	{
380
		$manager = \Aimeos\MShop::create( $this->context(), 'product' );
381
		$search = $manager->filter()->add( ['product.code' => $codes] )->slice( 0, count( $codes ) );
382
383
		return $manager->search( $search, $domains )->col( null, 'product.code' );
384
	}
385
386
387
	/**
388
	 * Imports the CSV file from the given path
389
	 *
390
	 * @param string $path Relative path to the CSV file
391
	 * @return int Number of lines which couldn't be imported
392
	 */
393
	protected function import( string $path ) : int
394
	{
395
		$context = $this->context();
396
		$logger = $context->logger();
397
398
		$logger->info( sprintf( 'Started product import from "%1$s"', $path ), 'import/csv/product' );
399
400
		$maxcnt = $this->max();
401
		$skiplines = $this->skip();
402
		$domains = $this->domains();
403
404
		$mappings = $this->mapping();
405
		$processor = $this->getProcessors( $mappings );
406
		$codePos = $this->getCodePosition( $mappings['item'] );
407
408
		$fs = $context->fs( 'fs-import' );
409
		$fh = $fs->reads( $path );
410
		$total = $errors = 0;
411
412
		for( $i = 0; $i < $skiplines; $i++ ) {
413
			fgetcsv( $fh );
414
		}
415
416
		while( ( $data = $this->getData( $fh, $maxcnt, $codePos ) ) !== [] )
417
		{
418
			$products = $this->getProducts( array_keys( $data ), $domains );
419
			$errors += $this->importProducts( $products, $data, $mappings['item'], [], $processor );
420
421
			$total += count( $data );
422
			unset( $products, $data );
423
		}
424
425
		$processor->finish();
426
		fclose( $fh );
427
428
		if( !empty( $backup = $this->backup() ) ) {
429
			$fs->move( $path, $backup );
430
		} else {
431
			$fs->rm( $path );
432
		}
433
434
		$str = sprintf( 'Finished product import from "%1$s" (%2$d/%3$d)', $path, $errors, $total );
435
		$logger->info( $str, 'import/csv/product' );
436
437
		return $errors;
438
	}
439
440
441
	/**
442
	 * Imports the CSV data and creates new products or updates existing ones
443
	 *
444
	 * @param \Aimeos\Map $products List of products items implementing \Aimeos\MShop\Product\Item\Iface
445
	 * @param array $data Associative list of import data as index/value pairs
446
	 * @param array $mapping Associative list of positions and domain item keys
447
	 * @param array $types List of allowed product type codes
448
	 * @param \Aimeos\Controller\Jobs\Common\Product\Import\Csv\Processor\Iface $processor Processor object
449
	 * @return int Number of products that couldn't be imported
450
	 * @throws \Aimeos\Controller\Jobs\Exception
451
	 */
452
	protected function importProducts( \Aimeos\Map $products, array $data, array $mapping, array $types,
453
		\Aimeos\Controller\Jobs\Common\Product\Import\Csv\Processor\Iface $processor ) : int
454
	{
455
		$items = [];
456
		$errors = 0;
457
		$context = $this->context();
458
		$manager = \Aimeos\MShop::create( $context, 'index' );
459
460
		foreach( $data as $code => $list )
461
		{
462
			$manager->begin();
463
464
			try
465
			{
466
				$code = trim( $code );
467
				$product = $products[$code] ?? $manager->create();
468
				$map = current( $this->getMappedChunk( $list, $mapping ) ); // there can only be one chunk for the base product data
469
470
				if( $map )
471
				{
472
					$type = $this->checkType( $this->val( $map, 'product.type', $product->getType() ) );
473
474
					if( $config = $this->val( $map, 'product.config' ) ) {
475
						$map['product.config'] = json_decode( $config ) ?: [];
476
					}
477
478
					$product = $product->fromArray( $map, true );
479
					$product = $manager->save( $product->setType( $type ) );
480
481
					$processor->process( $product, $list );
0 ignored issues
show
Bug introduced by
It seems like $product can also be of type Aimeos\Map; however, parameter $product of Aimeos\Controller\Jobs\C...cessor\Iface::process() does only seem to accept Aimeos\MShop\Product\Item\Iface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

481
					$processor->process( /** @scrutinizer ignore-type */ $product, $list );
Loading history...
482
483
					$product = $manager->save( $product->setModified() );
484
					$items[$product->getId()] = $product;
485
				}
486
487
				$manager->commit();
488
			}
489
			catch( \Throwable $t )
490
			{
491
				$manager->rollback();
492
493
				$msg = sprintf( 'Unable to import product with code "%1$s": %2$s', $code, $t->getMessage() );
494
				$context->logger()->error( $msg, 'import/csv/product' );
495
496
				$errors++;
497
			}
498
		}
499
500
		return $errors;
501
	}
502
503
504
	/**
505
	 * Returns the path to the directory with the CSV file
506
	 *
507
	 * @return string Path to the directory with the CSV file
508
	 */
509
	protected function location() : string
510
	{
511
		/** controller/jobs/product/import/csv/location
512
		 * Directory where the CSV files are stored which should be imported
513
		 *
514
		 * It's the relative path inside the "fs-import" virtual file system
515
		 * configuration. The default location of the "fs-import" file system is:
516
		 *
517
		 * * Laravel: ./storage/import/
518
		 * * TYPO3: /uploads/tx_aimeos/.secure/import/
519
		 *
520
		 * @param string Relative path to the CSV files
521
		 * @since 2015.08
522
		 * @see controller/jobs/product/import/csv/backup
523
		 * @see controller/jobs/product/import/csv/destructive
524
		 * @see controller/jobs/product/import/csv/domains
525
		 * @see controller/jobs/product/import/csv/location
526
		 * @see controller/jobs/product/import/csv/mapping
527
		 * @see controller/jobs/product/import/csv/max-size
528
		 * @see controller/jobs/product/import/csv/skip-lines
529
		 */
530
		return (string) $this->context()->config()->get( 'controller/jobs/product/import/csv/location', 'product' );
531
	}
532
533
534
	/**
535
	 * Returns the CSV column mapping
536
	 *
537
	 * @return array CSV column mapping
538
	 */
539
	protected function mapping() : array
540
	{
541
		/** controller/jobs/product/import/csv/mapping
542
		 * List of mappings between the position in the CSV file and item keys
543
		 *
544
		 * The importer have to know which data is at which position in the CSV
545
		 * file. Therefore, you need to specify a mapping between each position
546
		 * and the MShop domain item key (e.g. "product.code") it represents.
547
		 *
548
		 * You can use all domain item keys which are used in the fromArray()
549
		 * methods of the item classes.
550
		 *
551
		 * These mappings are grouped together by their processor names, which
552
		 * are responsible for importing the data, e.g. all mappings in "item"
553
		 * will be processed by the base product importer while the mappings in
554
		 * "text" will be imported by the text processor.
555
		 *
556
		 * @param array Associative list of processor names and lists of key/position pairs
557
		 * @since 2018.04
558
		 * @see controller/jobs/product/import/csv/backup
559
		 * @see controller/jobs/product/import/csv/destructive
560
		 * @see controller/jobs/product/import/csv/domains
561
		 * @see controller/jobs/product/import/csv/location
562
		 * @see controller/jobs/product/import/csv/max-size
563
		 * @see controller/jobs/product/import/csv/skip-lines
564
		 */
565
		$map = (array) $this->context()->config()->get( 'controller/jobs/product/import/csv/mapping', $this->getDefaultMapping() );
566
567
		if( !isset( $map['item'] ) || !is_array( $map['item'] ) )
568
		{
569
			$msg = sprintf( 'Required mapping key "%1$s" is missing or contains no array', 'item' );
570
			throw new \Aimeos\Controller\Jobs\Exception( $msg );
571
		}
572
573
		return $map;
574
	}
575
576
577
	/**
578
	 * Returns the maximum number of CSV rows to import at once
579
	 *
580
	 * @return int Maximum number of CSV rows to import at once
581
	 */
582
	protected function max() : int
583
	{
584
		/** controller/jobs/product/import/csv/max-size
585
		 * Maximum number of CSV rows to import at once
586
		 *
587
		 * It's more efficient to read and import more than one row at a time
588
		 * to speed up the import. Usually, the bigger the chunk that is imported
589
		 * at once, the less time the importer will need. The downside is that
590
		 * the amount of memory required by the import process will increase as
591
		 * well. Therefore, it's a trade-off between memory consumption and
592
		 * import speed.
593
		 *
594
		 * @param integer Number of rows
595
		 * @since 2018.04
596
		 * @see controller/jobs/product/import/csv/backup
597
		 * @see controller/jobs/product/import/csv/destructive
598
		 * @see controller/jobs/product/import/csv/domains
599
		 * @see controller/jobs/product/import/csv/location
600
		 * @see controller/jobs/product/import/csv/mapping
601
		 * @see controller/jobs/product/import/csv/skip-lines
602
		 */
603
		return (int) $this->context()->config()->get( 'controller/jobs/product/import/csv/max-size', 1000 );
604
	}
605
606
607
	/**
608
	 * Returns the number of rows skipped in front of each CSV files
609
	 *
610
	 * @return int Number of rows skipped in front of each CSV files
611
	 */
612
	protected function skip() : int
613
	{
614
		/** controller/jobs/product/import/csv/skip-lines
615
		 * Number of rows skipped in front of each CSV files
616
		 *
617
		 * Some CSV files contain header information describing the content of
618
		 * the column values. These data is for informational purpose only and
619
		 * can't be imported into the database. Using this option, you can
620
		 * define the number of lines that should be left out before the import
621
		 * begins.
622
		 *
623
		 * @param integer Number of rows
624
		 * @since 2015.08
625
		 * @see controller/jobs/product/import/csv/backup
626
		 * @see controller/jobs/product/import/csv/destructive
627
		 * @see controller/jobs/product/import/csv/domains
628
		 * @see controller/jobs/product/import/csv/location
629
		 * @see controller/jobs/product/import/csv/mapping
630
		 * @see controller/jobs/product/import/csv/max-size
631
		 */
632
		return (int) $this->context()->config()->get( 'controller/jobs/product/import/csv/skip-lines', 0 );
633
	}
634
}
635