/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * function to batch update the sell_price for ubercart products from a csv file * @param string path to csv file */ function sitehelper_batchupdate($csv_file) { $row = 1; //print $num; //print "<p> $num fields in line $row: <br /></p>\n"; $row++; //print $data[0] . " " . $data[1] . $data[2] . $data[3] . "<br />" ; db_query('update uc_products set sell_price = "%s" where nid = %d and vid = %d', $data[0], $data[2], $data[3]); } } } //sitehelper_batchupdate("http://[site_url]/sites/all/modules/sitehelper/books.csv");