You are here

public function ImportingParameters::matchParameters in Commerce Smart Importer 8

Decide to create product or not.

File

src/ImportingParameters.php, line 82

Class

ImportingParameters
Parameters what will be imported.

Namespace

Drupal\commerce_smart_importer

Code

public function matchParameters($field_logs) {
  if ($this->createProduct === FALSE) {
    return FALSE;
  }
  foreach ($field_logs as $field_log) {
    if ($field_log['required'] === FALSE) {
      return FALSE;
    }
    if ($this->defaultValues === FALSE && $field_log['default_value'] === FALSE) {
      return FALSE;
    }
    if ($this->exceedsCardinality === FALSE && $field_log['cardinality'] === FALSE) {
      return FALSE;
    }
    if ($this->duplicateValues === FALSE && $field_log['duplicates'] === FALSE) {
      return FALSE;
    }
    if ($this->incorrectValues === FALSE && count($field_log['not_valid'])) {
      return FALSE;
    }
    if (is_array($field_log) && array_key_exists('sku', $field_log)) {
      if ($this->sku === FALSE && count($field_log['not_valid'])) {
        return FALSE;
      }
    }
  }
  return TRUE;
}