$messagebox->add('Uploaded file "' . $file['name'] . '" has invalid file format! Please use only csv version.'); } else { $file_content_raw = file_get_contents($file['tmp_name']); //IMPORTANT NOTE!! CSV FILE FROM AMAZON IS ENCODED AS "UCS-2" (whatever it means :p) $file_content = mb_convert_encoding($file_content_raw, mb_internal_encoding(), 'UCS-2'); $file_rows = explode("\n", $file_content); if (count($file_rows) > 1) { $report_type = $amvd_report_type[$_POST['report_type']]; $report_date = tep_db_prepare_input($_POST['report_date']); $upload_date = date('d.m.Y'); $import_info = "{$report_type} {$report_date}"; if ($report_date != $upload_date) { $import_info .= " (uploaded on {$upload_date})"; } $download_id = $class_jd->addDownload($jng_sp_id, 'IMPORTDATA', $file['name'], 'D', $session_userinfo['name'], $import_info); $class_jc->importDataClear($jng_sp_id); $ean_found = 0; $ean_match = 0; foreach ($file_rows as $rc => $row) { if ($rc > 0) { $columns = explode("\t", $row); $products_ean = $columns[translateExcelColumnToArrayColumn($col_location['products_ean'])]; if (strlen($products_ean) == 13) { $ean_found++; $pdata = $class_ean->getProductArticle($products_ean); $products_id = $pdata['products_id']; $articles_id = $pdata['articles_id']; if ($products_id > 0) { $ean_match++; $sp_products_id = ''; $sp_articles_id = $columns[translateExcelColumnToArrayColumn($col_location['sp_articles_id'])];