This is the CSV pattern instruction. Pls PM me if you can help. THX The CSV file must have the following structure: Category | Manufacturer | Model | Product code| Product title| Product description| Product URL| Product image URL| Product price| Currency The field order is mandatory. Category - product category on your website Manufacturer - the manufacturer Model - product model Product code - product code, if available Product title - product title on your website Product description - Product description on your website Product URL - URL address of your product from your website Product image URL - URL of your product image, if available Product price - the price of your product Currency - USD If some of the fields are missing, you may leave them blank using || Please see the following example for more details: Category: Motherboard Manufacturer: ASUS Title: Asus motherboard Description: Asus motherboard is one of the finest available Product URL: http://www.yourshop.com/asus-motherboard/ Product image: http://www.yourshop.com/asus-motherboard/asus.jpg Price: 30.00 USD The file looks like this: Motherboard|ASUS|||Asus motherboard|Asus motherboard is one of the finest available|http://www.yourshop.com/asus-mother...rshop.com/asus-motherboard/asus.jpg|30.00|USD If you have 10,000 products, the feed file must have 10,000 lines as above, one product per line.
What is the format of the data feed that you are using and from where are you uploading it to google base. specify the source and conversion would be done as accordingly.
I am using CSV files originally. Just want to convert this original CSV to follow the given product info. format. I am uploading it to another database. Thx
You can use fgetcsv to parse the csv file u have into subsequent arrays based on the number of lines u have..... <?php $row = 1; if (($handle = fopen("test.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); } ?> PHP: once u have got the array write a simple function to convert back the array into the specific csv format which u want.... function array_to_scv($array, $header_row = true, $col_sep = "|", $row_sep = "\n", $qut = '"') { if (!is_array($array) or !is_array($array[0])) return false; //Header row. if ($header_row) { foreach ($array[0] as $key => $val) { //Escaping quotes. $key = str_replace($qut, "$qut$qut", $key); $output .= "$col_sep$qut$key$qut"; } $output = substr($output, 1)."\n"; } //Data rows. foreach ($array as $key => $val) { $tmp = ''; foreach ($val as $cell_key => $cell_val) { //Escaping quotes. $cell_val = str_replace($qut, "$qut$qut", $cell_val); $tmp .= "$col_sep$qut$cell_val$qut"; } $output .= substr($tmp, 1).$row_sep; } return $output; } PHP: