public function CSVImportForm::getFirstVariationIndex in Commerce Smart Importer 8
Searches for first field of variation.
1 call to CSVImportForm::getFirstVariationIndex()
- CSVImportForm::importProducts in src/
Form/ CSVImportForm.php - Reads part of CSV file and imports it if it is valid.
File
- src/
Form/ CSVImportForm.php, line 476
Class
- CSVImportForm
- Class CSVImportForm enales you upload CSV and import products from it.
Namespace
Drupal\commerce_smart_importer\FormCode
public function getFirstVariationIndex($fields) {
$index = FALSE;
foreach ($fields['variation'] as $field) {
if (!array_key_exists('index', $field)) {
continue;
}
if ($index === FALSE) {
$index = $field['index'];
}
elseif ($index > $field['index']) {
$index = $field['index'];
}
}
return $index;
}