Im using a CSV Import plugin for open cart and by default is completely skips products if they are missing any of the column fields. Is there anyway i can read the file and replace all the empty fields with 'null' or 0 and send it back to the code.
skipping that check below causes an offset in the reading/placing format !
$fh = fopen($file, 'r');
if(!$fh) die('File no good!');
// Get headings
$headings = fgetcsv($fh, 0, $delim);
$num_cols = count($headings);
$num_rows = 0;
//Read the file as csv
while (($row = fgetcsv($fh, 0, $delim)) !== FALSE) {
//missed product if num columns in this row not the same as num headings
if (count($row) != $num_cols) {
$this->total_items_missed++;
continue;
}
for ($i=0; $i<count($headings); $i++) {
$raw_prod[$headings[$i]] = $row[$i];
}