public function importInstance($record, CsvImportProfile $profile) { if (array_key_exists('sku', $record)) { $instance = Product::getInstanceBySKU($record['sku']); $id = $instance ? $instance->getID() : 0; if ($this->allowOnly == self::CREATE && $id > 0) { throw new Exception('Record exists'); } if ($this->allowOnly == self::UPDATE && $id == 0) { throw new Exception('Record not found'); } } else { // if identified by smth else what then? } return parent::importInstance($record, $profile); }