} /////////////////////////////////////////// } //incremement the count so we don't insert the first line containing field headers $count++; /////////////// } /////////////////////// END of ROW /////////////////////// //error check if (!feof($handle)) { echo '<span style="color:red;">Error: unexpected fgets() fail</span><br />'; } /////////////////////// fclose($handle); // output numbers $total_matches = $mpn_matches + $gtin_matches; echo "<br />Finished processing RPRO file - {$count} items<br />Finished matching items between SE and RPRO files<br />MPN Matches: {$mpn_matches}<br />GTIN Matches: {$gtin_matches}<br />"; echo "======================<br />"; echo "Total matching items - {$total_matches}<br /><br />"; // store item counts in DB storeItemCount('RPRO', $count); storeItemCount('MPN', $mpn_matches); storeItemCount('GTIN', $gtin_matches); storeItemCount('total_matches', $total_matches); exit; } else { // Ooops! There was a problem echo '<span style="color:red;">ERROR! Could not open RPRO file</span>'; exit; }
$availability = $exploded_tab_array[9]; $expiration_date = $exploded_tab_array[10]; $id = $exploded_tab_array[11]; $mpn = $exploded_tab_array[12]; $gtin = $exploded_tab_array[13]; $color = $exploded_tab_array[14]; $size = $exploded_tab_array[15]; $shipping_weight = $exploded_tab_array[16]; in_array($mpn, $freeShippingByMPN) ? $shipping = 'US:::0.00 USD' : ($shipping = ''); /////////////// //hack so we don't insert the first line if ($count > 0) { //call our function to add a new Item and get back the InsertID $item_id = insertNewOnlineListing($link, $condition, $brand, $title, $description, $image_link, $product_type, $google_product_category, $price, $availability, $expiration_date, $id, $mpn, $gtin, $color, $size, $shipping_weight, $shipping, $gender, $age_group); } //incremement the counter $count++; /////////////// } /////////////////////// //error check if (!feof($handle)) { echo "Error: unexpected fgets() fail\n"; } /////////////////////// fclose($handle); // store item count storeItemCount('SE', $count); } //all done! echo '<br />Finished processing SE file! - ' . $count . ' items<br /><br />';