makenoiz Posted November 25, 2011 Share Posted November 25, 2011 I'm an intermediate php coder however I have a new situation. I need to do some remapping of categories from CSV files we get from our supplier for our php ecommerce store. We use mySQL back end. We are importing data from a Supplier and need to remap the category names for our online store. There are 16,000 entries in the CSV file. This is what I need to do. 1) grab the CSV from the suppliers (from their ftp location) 2) remap the suppliers category names on the acquired CSV to our stores category names. I can either create a new table with the category name relation ships (probably best?) or read my mapping CSV ? 3) save the new CSV to our server where our auto import program can grab it. Eventually, Id like a cron to run the new script but for now Ill do it manually during testing period. Thats it! but... as simple as it sounds, I dont know how to start this. Below is an example of what needs to be dont just to clarify. PHP Code: Our Category(A) | Their Category(B) | Product © | Product Cat (D) | New Product Cat (E) 1. dog/leash/long | Pet/walking | Item A | Pet/sleeping|bed ** This is what we need to get** 2. dog/leash|long | Pet/walking | Item B | Pet/walking 3. dog/leash|long | Pet/sleeping bed | Item C | Pet/walking Here is my pseudo code: for each value in Column D (run the test on each value in Column D) for each value in B as i ( check each value in Column B) if B(i) = D1 then E1 =A(i) end for end for The new path in this example for Item A would be A3 and would be written to E1. I have 15,000 entries to do. Thank you for any help Link to comment https://forums.phpfreaks.com/topic/251799-remapping-using-php-and-csv-files/ Share on other sites More sharing options...
Laash Posted November 26, 2011 Share Posted November 26, 2011 Hi Connect to the remove server with ftp_connect php functions, then read the csv file using fopen, or file_get_contents, and the upload it back to the remove server with the ftp_connect set of functions. Link to comment https://forums.phpfreaks.com/topic/251799-remapping-using-php-and-csv-files/#findComment-1291392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.