Jump to content

Froogle Export


Guest

Recommended Posts

Hi, im wondering what format the Froogle export is in? I cant get it to work and I cant even use the file to make my own froogle file, Does anyone know if i am missing anything?

Thanks

jamie

Link to comment
Share on other sites

frooglefeed is a txt file. It is created using the following php file. Name it frooglefeeder.php

<?php

/***************************************************************************

* This file borrows heavily from portions of scripts already in

* Cubecart.

*

* At present it needs to be run from the admin/backup/ folder. I am not

* sure why I decided that was good place, but it is what it is.

* Eventually, I will integrate so it can be run from the admin console.

*

* Ok, so once it is uploaded.

* Enter http://www.yoursite/admin/backup/frooglefeeder.php into

* your browser's address bar. You hopefully will see a message saying

* frooglefeed.txt has been created. The file is created in the admin/backup/ folder.

* If you refresh or enter the address again it will append to the end

* of the file, so each time you want to create a feed you must remove

* the .txt before you do it. (Yeah, I'll fix that)

*

* The file is tab delimited and "should" meet Froogle's requirements.

* I would highly recommend opening in Excel and look. There are things that

* cause it to skip and get out of sequence. Notably, the use of tags in the

* title or description. Below are 2 variables $bad and $ clean. Add anything

* to the $bad that is causing it to jump sequence, be sure to also add the replacement

* in $clean. At present everything that I took out is replaced with a space, that

* worked for me, you may need something different.

*

* I decided for my needs that if an item was on sale, I wanted that price

* used for the froogle feed. Again you may decide differently.

* Set $list_sale to "N" if you would rather show standard pricing.

*

* I appreciate any input good or bad. This is a work in progress.

* PM me on the forums grcdude2 or email me directly at

* [email protected]

***************************************************************************/

include("../config.php");

include( "../settings.inc.php");

// the good, the bad, and the ugly

// $bad is anything that causes it to jump out of sequence

// $clean is what you want to replace $bad with

// make sure you have the same number of entries in both

$bad=array("<br>","\r\n","<i>","</i>","<b>","</b>","<",">");

$clean=array(" "," "," "," "," "," "," "," ");

// show sale price in listing Y or N

$list_sale="Y";

$filename="frooglefeed.txt";

if (!$handle = fopen($filename, 'a')) {

echo "Cannot open file ($filename)";

exit;

}

$line="product_url\tname\tdescription\timage_url\tcategory\tprice\n";

if (fwrite($handle, $line) === FALSE) {

echo "Cannot write to file ($filename)";

exit;

}

echo"Creating header line...<br>";

$cat_info = mysql_query("select * from ".$prefix."store_inventory")or die(mysql_error());

while($row = mysql_fetch_array($cat_info))

{

$product=$row["product"];

$name=$row["title"];

$image=$row["image"];

$desc = $row["description"];

$price=$row["price"];

$sale_price = $row["sale_price"];

$desc=stripslashes($desc);

$cat_id = $row["cat_id"];

$desc=str_replace($bad,$clean,$desc);

if ($image!="nophoto.jpg")

{

$image_url=$site_url."/images/".$image;

} else {

$image_url="";

}

if (($sale_price!=="0.00")&&($list_sale!="N"))

{

$price=$sale_price;

}

$name=stripslashes($name);

$product_url=$site_url."/view_product.php?product=".$product;

// start make category url

$sql_1 = "select * from ".$prefix."store_category where cat_id = $cat_id";

$result1 = mysql_query ($sql_1);

$row = @mysql_fetch_array($result1);

$catid_1 = $row["cat_id"];

$catfatherid_1 = $row["cat_father_id"];

$catname_1 = $row["category"];

$t1 = $catname_1;

$catid1 = $catid_1;

if ($catfatherid_1 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_2 = $row["cat_id"];

$catfatherid_2 = $row["cat_father_id"];

$catname_2 = $row["category"];

$t2 = $catname_2;

$catid2 = $catid_2;

}

if ($catfatherid_2 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_3 = $row["cat_id"];

$catfatherid_3 = $row["cat_father_id"];

$catname_3 = $row["category"];

$t3 = $catname_3;

$catid3 = $catid_3;

}

if ($catfatherid_3 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_4 = $row["cat_id"];

$catfatherid_4 = $row["cat_father_id"];

$catname_4 = $row["category"];

$t4 = $catname_4;

$catid4 = $catid_4;

}

if ($catfatherid_4 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_5 = $row["cat_id"];

$catfatherid_5 = $row["cat_father_id"];

$catname_5 = $row["category"];

$t5 = $catname_5;

$catid5 = $catid_5;

}

if ($catfatherid_5 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_6 = $row["cat_id"];

$catfatherid_6 = $row["cat_father_id"];

$catname_6 = $row["category"];

$t6 = $catname_6;

$catid6 = $catid_6;

}

if ($catfatherid_6 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_7 = $row["cat_id"];

$catfatherid_7 = $row["cat_father_id"];

$catname_7 = $row["category"];

$t7 = $catname_7;

$catid7 = $catid_7;

}

if ($catfatherid_7 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_8 = $row["cat_id"];

$catfatherid_8 = $row["cat_father_id"];

$catname_8 = $row["category"];

$t8 = $catname_8;

$catid8 = $catid_8;

}

if ($catfatherid_8 <> 0)

{

$sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8";

$result = mysql_query ($sql_lowercat);

$row = @mysql_fetch_array($result);

$catid_9 = $row["cat_id"];

$catfatherid_9 = $row["cat_father_id"];

$catname_9 = $row["category"];

$t9 = $catname_9;

$catid9 = $catid_9;

}

if ($t1!="")

$category=$t1;

if ($t2!="")

$category=$t2." > ".$t1;

if ($t3!="")

$category=$t3." > ".$t2." > ".$t1;

if ($t4!="")

$category=$t4." > ".$t3." > ".$t2." > ".$t1;

if ($t5!="")

$category=$t5." > ".$t4." > ".$t3." > ".$t2." > ".$t1;

if ($t6!="")

$category=$t6." > ".$t5." > ".$t4." > ".$t3." > ".$t2." > ".$t1;

if ($t7!="")

$category=$t7." > ".$t6." > ".$t5." > ".$t4." > ".$t3." > ".$t2." > ".$t1;

if ($t8!="")

$category=$t8." > ".$t7." > ".$t6." > ".$t5." > ".$t4." > ".$t3." > ".$t2." > ".$t1;

if ($t9!="")

$category=$t9." > ".$t8." > ".$t7." > ".$t6." > ".$t5." > ".$t4." > ".$t3." > ".$t2." >

".$t1;

$t1="";$t2="";$t3="";$t4="";$t5="";$t6="";$t7="";$t8="";$t9="";

// end make category url

$line="$product_url\t$name\t$desc\t$image_url\t$category\t$price\n";

if (fwrite($handle, $line) === FALSE) {

echo "Cannot write to file ($filename)";

exit;

}

echo"File frooglefeed.txt updating...<br>";

}

echo"File frooglefeed.txt completed. If you do not see any error messages it was a

success.<br>

<b>Be sure to check the file for errors before submitting.</b><br>";

fclose($handle);

?>

Link to comment
Share on other sites

Hi thanks for your reply, I'm gonna wait for the final version to come out tomorrow, and if the Froogle in admin does not work Ill shall try your method!

Thanks Mate

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...
  • 2 months later...
Guest ByondF1

I upgraded to the latest release release 3.0.8 and since I did I haven't been able to export a froogle file. When I try I get a 500 error. I don't know what the problem is. I tried your script but go the following:

Creating header line...

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I would really like to update my froogle info. Any suggestions?

Thanx.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...