Jump to content

ludwig

New Members
  • Posts

    7
  • Joined

  • Last visited

ludwig's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I added a comma at the end of header line and a break line at the end of file, my code is similar to this now: <?php define( 'FEEDNAME', 'catalog_products.csv' ); $OutFile = "feeds/" . FEEDNAME; $destination_file = FEEDNAME; $source_file = $OutFile; if ( file_exists( $OutFile ) ) { unlink( $OutFile ); } $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,"; $output .= "\n"; $output .= "Test1,Test2,Test3,Test4,Test5,Test6,Test7,Test8,Test9,Test10,Test11,Test12,Test13,Test14,Test15,Test16,Test17,Test18,Test19,Test20,Test21,Test22,Test23,Test24"; $output .= " \n"; $output .= " \n"; $fp = fopen( $OutFile, "a" ); $fout = fwrite( $fp, $output ); fclose( $fp ); echo "<a href=\"../" . $OutFile . "\" target=\"_blank\">" . $destination_file . "</a><br>\n\n"; chmod( $OutFile, 0777 ); ?> Thanks @Barand Facebook now initiated the process without errors
  2. Many thanks for this visibility, what software are you using to compare ?
  3. Yes, looks the same, also I opened both on notepad to compare. I will attached both files, before and after: https://www.watercenter.me/feeds/catalog_products_before.csv (Not working) https://www.watercenter.me/feeds/catalog_products_after.csv (Working) Cheers!
  4. Also I tried this code : define('FEEDNAME', 'catalog_products.csv'); $OutFile = "feeds/" . FEEDNAME; $destination_file = FEEDNAME; $source_file = $OutFile; if ( file_exists( $OutFile ) ) { unlink( $OutFile ); } $list = array ( array("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"), array("Test1","Test2","Test3","Test4","Test5","Test6","Test7","Test8","Test9","Test10","Test11","Test12","Test13","Test14","Test15","Test16","Test17","Test18","Test19","Test20","Test21","Test22","Test23","Test24") ); $file = fopen($OutFile,"w"); foreach ($list as $line) { fputcsv($file, $line); } fclose($file); Same errors, and also if I save the file with Excel, the magic happen, Facebook like it 😕
  5. If I change the mode paratere to r+, Facebook give me this error : URL does not link to supported file Make sure the URL that you provide links to a CSV, TSV or XML (RSS/ATOM) file and begins with http, https, ftp or sftp.
  6. @gizmola Thank you and thanks for all for the help. I minimized my script to this: <?php define( 'FEEDNAME', 'catalog_products.csv' ); $OutFile = "feeds/" . FEEDNAME; $destination_file = FEEDNAME; $source_file = $OutFile; if ( file_exists( $OutFile ) ) { unlink( $OutFile ); } $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"; $output .= "\n"; $output .= "Test1,Test2,Test3,Test4,Test5,Test6,Test7,Test8,Test9,Test10,Test11,Test12,Test13,Test14,Test15,Test16,Test17,Test18,Test19,Test20,Test21,Test22,Test23,Test24"; $output .= " \n"; $fp = fopen( $OutFile, "a" ); $fout = fwrite( $fp, $output ); fclose( $fp ); echo "<a href=\"../" . $OutFile . "\" target=\"_blank\">" . $destination_file . "</a><br>\n\n"; chmod( $OutFile, 0777 ); ?> Still getting errors when used with Facebook.. what confuse me is if I open the file with Excel "Do nothing" just save it and upload it again, the file is accepted by Facebook Feed. Could be something related to the mode parameter "a" in fopen( $OutFile, "a" ); ?
  7. 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 :
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.