I am working on one custom module where i imported products from csv successfully.But i am doing like first field must be sku and second should be name.But the issue is if someone change the sequence then it creates issues.Is there any way i can map csv fields so that i can adjust fields with that.I am getting csv fields like this :
$file = $path."/".$_FILES['file_uplod']['name'];
$csv = new Varien_File_Csv();
$data = $csv->getData($file);
for($i=1; $i<count($data); $i++){
$name = $data[$i][1];
}
I want to code some generic so fields map with DB fields name.
sku
,name
. How can i map that what is the position of these fields in the row ? got my pointsku,name
. Second row"some_sku","Some name"
. Then you will parse the csv and know that the first column (index 0) is the product sku and the second column (index 1) is the product name.