When I output the formatted data to a csv file, I am getting a "." in $line[3] of the first if statement , and I need it to be blank. I am getting bug eyes!
$header_row = array('Name', 'Model', 'Product Price', 'Qty', 'Categories', 'Description' , 'Product Image', 'Large Image', ' Weight', 'Vendors Price', 'Vendors Product Id', 'Wholesale', 'Special Products Price', 'Product Attributes');
fputcsv($out, $header_row, ',');
while(($line = fgetcsv($in, 0, ',')) !== false)
{
if($line[3] == 0 )
{
$output = str_replace('0', " " ,$line[3]);
$formatted = array($line[8], $line[1] ,($line[2]/0.4) , $line[4] , str_replace(';', ';;', $line[6]) , $line[8] , $line[9] , $line[10] , $line[5] , ($line[2]/0.7) , $line[1] ,$output , $line[7]);
fputcsv($out, $formatted, ','); // change '|' to ',' if you want comma delimiter
}
if($line[3] != 0 )
{
$formatted = array($line[8], $line[1] ,($line[2]/0.4) , $line[4] , str_replace(';', ';;', $line[6]) , $line[8] , $line[9] , $line[10] , $line[5] , ($line[2]/0.7), $line[1] , $line[3] , $line[7]);
fputcsv($out, $formatted, ','); // change '|' to ',' if you want comma delimiter
}
}