Hello,
I created a PHP script to export my catalog on a ecommerce website on a CSV file and use it to feed Facebook catalog. But Facebook catalog can't read the columns:
But if I open the csv file on Excel, do nothing, just Save it and use it again on Facebook, then Facebook accept it, and all data are transferred !!
This is the PHP script:
define('FEEDNAME', 'catalog_products.csv');
$OutFile = "feeds/" . FEEDNAME;
$output = "id,title,description,availability,condition,price,link,image_link,brand,google_product_category,fb_product_category,quantity_to_sell_on_facebook,sale_price,sale_price_effective_date,item_group_id,gender,color,size,age_group,material,pattern,shipping,shipping_weight,style";
$attributesColumns = array();
$output .= "\n";
$output .= $row->id . ",";
$output .= $productTitle . ",";
$output .= 'Visit our website for more info.' . ",";
$output .= $availability . ",";
$output .= 'New' . ",";
$output .= $row->price . ",";
$output .= $row->image_url . ",";
$output .= $row->brand . ",";
$output .= $row->catName . ",";
$output .= $row->catName . ",";
$output .= $row->quantity . ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= ",";
$output .= " \n";
$fp = fopen( $OutFile , "a" );
$fout = fwrite( $fp , $output );
fclose( $fp );
Maybe I should add some headers to the export file ? I'm not sure how to handle this
Any help please ?
Cheers :