Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Froogle/Google Base, Yahoo, and Bizrate Feeds


abuata

Recommended Posts

here is what I get when I run the feed:

 

Warning: fopen(/hsphere/local/home/abuata/lil-raskals.com/feeds/lil_raskals_com.txt): failed to open stream: No such file or directory in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 305

 

Warning: fwrite(): supplied argument is not a valid stream resource in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 306

 

Warning: fclose(): supplied argument is not a valid stream resource in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 307

File completed:

 

Warning: chmod(): No such file or directory in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 309

Connected to uploads.google.com, for user abuata

uploads.google.com: FTP upload has failed!

 

Script timer: 4.282747 seconds.

 

Here is a copy of file lil-raskals.com/catalog/admin/froogle.php :

 

<php>curCatID;

$catName = $catRow->catName;

$catParID = $catRow->parentCatID;

if($catName != "")

{

$catTempDes[$catKey]=$catName;

$catTempPar[$catKey]=$catParID;

}

}

 

foreach($catTempDes as $curID=>$des) //don't need the $des

{

$catIndex = findCat($curID, $catTempPar, $catTempDes, $catIndex);

}

 

$_strip_search = array(

"![\t ]+$|^[\t ]+!m", // remove leading/trailing space chars

'%[\r\n]+%m'); // remove CRs and newlines

$_strip_replace = array(

'',

' ');

$_cleaner_array = array(">" => "> ", "?" => "", "." => "", "?" => "", "" => "", "\t" => "", " " => "");

 

if ( file_exists( $OutFile ) )

unlink( $OutFile );

 

$output = "product_url \t name \t description \t price \t image_url \t category \t offer_id";

 

//create optional section

if($optional_sec == 1)

{

if($instock == 1)

$output .= "\t instock ";

if($shipping == 1)

$output .= "\t shipping ";

if($brand == 1)

$output .= "\t brand ";

if($upc == 1)

$output .= "\t upc ";

if($manufacturer_id == 1)

$output .= "\t manufacturer_id ";

if($product_type == 1)

$output .= "\t product_type ";

if($currency == 1)

$output .= "\t currency ";

if($feed_language == 1)

$output .= "\t language ";

if($ship_to == 1)

$output .= "\t ship_to ";

if($ship_from == 1)

$output .= "\t ship_from ";

}

$output .= "\n";

 

 

$result=mysql_query( $sql )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql = " . htmlentities($sql) );

 

//Currency Information

if($convertCur)

{

$sql3 = "

SELECT

currencies.value AS curUSD

FROM

currencies

WHERE currencies.code = '$curType'

";

 

$result3=mysql_query( $sql3 )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql3 = " . htmlentities($sql3) );

$row3 = mysql_fetch_object( $result3 );

}

 

$loop_counter = 0;

 

while( $row = mysql_fetch_object( $result ) )

{

if (isset($already_sent[$row->id])) continue; // if we've sent this one, skip the rest of the while loop

 

if( $row->prodStatus == 1 || ($optional_sec == 1 && $instock == 1) )

{

 

if($convertCur)

{

$row->price = ereg_replace("[^.0-9]", "", $row->price);

$row->price = $row->price * $row3->curUSD;

$row->price = number_format($row->price, 2, '.', ',');

}

 

$output .= $row->product_url . "\t" .

preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row->name, $_cleaner_array) ) ) . "\t" .

preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row->description, $_cleaner_array) ) ) . "\t" .

$row->price . "\t" .

$row->image_url . "\t" .

$catIndex[$row->prodCatID] . "\t" .

$row->id;

 

//optional values section

if($optional_sec == 1)

{

if($instock == 1)

{

if($row->prodStatus == 1)

{

$prodStatusOut = "Y";

}

else

{

$prodStatusOut = "N";

}

$output .= " \t " . $prodStatusOut;

}

if($shipping == 1)

$output .= " \t " . $lowestShipping;

if($brand == 1)

$output .= " \t " . $row->mfgName;

if($upc == 1)

$output .= " \t " . "Not Supported";

if($manufacturer_id == 1)

$output .= " \t " . "Not Supported";

if($product_type == 1)

{

$catNameTemp = strtolower($catName);

if($catNameTemp == "books")

$productTypeOut = "book";

else if($catNameTemp == "music")

$productTypeOut = "music";

else if($catNameTemp == "videos")

$productTypeOut = "video";

else

$productTypeOut = "other";

 

$output .= " \t " . $productTypeOut;

}

if($currency == 1)

$output .= " \t " . $default_currency;

if($feed_language == 1)

$output .= " \t " . $default_feed_language;

if($ship_to == 1)

$output .= " \t " . $default_ship_to;

if($ship_from == 1)

$output .= " \t " . $default_ship_from;

}

$output .= " \n";

}

$already_sent[$row->id] = 1;

 

 

$loop_counter++;

if ($loop_counter>750) {

$fp = fopen( $OutFile , "a" );

$fout = fwrite( $fp , $output );

fclose( $fp );

$loop_counter = 0;

$output = "";

}

}

 

$fp = fopen( $OutFile , "a" );

$fout = fwrite( $fp , $output );

fclose( $fp );

echo "File completed: " . $destination_file . "<br>\n";

chmod($OutFile, 0777);

 

 

//Start FTP to Froogle

 

function ftp_file( $ftpservername, $ftpusername, $ftppassword, $ftpsourcefile, $ftpdirectory, $ftpdestinationfile )

{

// set up basic connection

$conn_id = ftp_connect($ftpservername);

if ( $conn_id == false )

{

echo "FTP open connection failed to $ftpservername <BR>\n" ;

return false;

}

 

// login with username and password

$login_result = ftp_login($conn_id, $ftpusername, $ftppassword);

 

// check connection

if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has failed!<BR>\n";

echo "Attempted to connect to " . $ftpservername . " for user " . $ftpusername . "<BR>\n";

return false;

} else {

echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "<BR>\n";

}

 

if ( strlen( $ftpdirectory ) > 0 )

{

if (ftp_chdir($conn_id, $ftpdirectory )) {

echo "Current directory is now: " . ftp_pwd($conn_id) . "<BR>\n";

} else {

echo "Couldn't change directory on $ftpservername<BR>\n";

return false;

}

}

 

ftp_pasv ( $conn_id, true ) ;

// upload the file

$upload = ftp_put( $conn_id, $ftpdestinationfile, $ftpsourcefile, FTP_ASCII );

 

// check upload status

if (!$upload) {

echo "$ftpservername: FTP upload has failed!<BR>\n";

return false;

} else {

echo "Uploaded " . $ftpsourcefile . " to " . $ftpservername . " as " . $ftpdestinationfile . "<BR>\n";

}

 

// close the FTP stream

ftp_close($conn_id);

 

return true;

}

 

ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $source_file, $ftp_directory, $destination_file);

 

//End FTP to Froogle

 

// End TIMER

// ---------

$etimer = explode( ' ', microtime() );

$etimer = $etimer[1] + $etimer[0];

echo '<p>';

printf( "Script timer: <b>%f</b> seconds.", ($etimer-$stimer) );

echo '</p>';

// ---------

 

?>

 

What the heck am I doing wrong????

Link to comment
Share on other sites

here is what I get when I run the feed:

 

Warning: fopen(/hsphere/local/home/abuata/lil-raskals.com/feeds/lil_raskals_com.txt): failed to open stream: No such file or directory in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 305

 

Warning: fwrite(): supplied argument is not a valid stream resource in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 306

 

Warning: fclose(): supplied argument is not a valid stream resource in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 307

File completed:

 

Warning: chmod(): No such file or directory in /hsphere/local/home/abuata/lil-raskals.com/catalog/admin/froogle.php on line 309

Connected to uploads.google.com, for user abuata

uploads.google.com: FTP upload has failed!

 

Script timer: 4.282747 seconds.

 

Here is a copy of file lil-raskals.com/catalog/admin/froogle.php :

 

<php>curCatID;

$catName = $catRow->catName;

$catParID = $catRow->parentCatID;

if($catName != "")

{

$catTempDes[$catKey]=$catName;

$catTempPar[$catKey]=$catParID;

}

}

 

foreach($catTempDes as $curID=>$des) //don't need the $des

{

$catIndex = findCat($curID, $catTempPar, $catTempDes, $catIndex);

}

 

$_strip_search = array(

"![\t ]+$|^[\t ]+!m", // remove leading/trailing space chars

'%[\r\n]+%m'); // remove CRs and newlines

$_strip_replace = array(

'',

' ');

$_cleaner_array = array(">" => "> ", "?" => "", "." => "", "?" => "", "" => "", "\t" => "", " " => "");

 

if ( file_exists( $OutFile ) )

unlink( $OutFile );

 

$output = "product_url \t name \t description \t price \t image_url \t category \t offer_id";

 

//create optional section

if($optional_sec == 1)

{

if($instock == 1)

$output .= "\t instock ";

if($shipping == 1)

$output .= "\t shipping ";

if($brand == 1)

$output .= "\t brand ";

if($upc == 1)

$output .= "\t upc ";

if($manufacturer_id == 1)

$output .= "\t manufacturer_id ";

if($product_type == 1)

$output .= "\t product_type ";

if($currency == 1)

$output .= "\t currency ";

if($feed_language == 1)

$output .= "\t language ";

if($ship_to == 1)

$output .= "\t ship_to ";

if($ship_from == 1)

$output .= "\t ship_from ";

}

$output .= "\n";

$result=mysql_query( $sql )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql = " . htmlentities($sql) );

 

//Currency Information

if($convertCur)

{

$sql3 = "

SELECT

currencies.value AS curUSD

FROM

currencies

WHERE currencies.code = '$curType'

";

 

$result3=mysql_query( $sql3 )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql3 = " . htmlentities($sql3) );

$row3 = mysql_fetch_object( $result3 );

}

 

$loop_counter = 0;

 

while( $row = mysql_fetch_object( $result ) )

{

if (isset($already_sent[$row->id])) continue; // if we've sent this one, skip the rest of the while loop

 

if( $row->prodStatus == 1 || ($optional_sec == 1 && $instock == 1) )

{

 

if($convertCur)

{

$row->price = ereg_replace("[^.0-9]", "", $row->price);

$row->price = $row->price * $row3->curUSD;

$row->price = number_format($row->price, 2, '.', ',');

}

 

$output .= $row->product_url . "\t" .

preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row->name, $_cleaner_array) ) ) . "\t" .

preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row->description, $_cleaner_array) ) ) . "\t" .

$row->price . "\t" .

$row->image_url . "\t" .

$catIndex[$row->prodCatID] . "\t" .

$row->id;

 

//optional values section

if($optional_sec == 1)

{

if($instock == 1)

{

if($row->prodStatus == 1)

{

$prodStatusOut = "Y";

}

else

{

$prodStatusOut = "N";

}

$output .= " \t " . $prodStatusOut;

}

if($shipping == 1)

$output .= " \t " . $lowestShipping;

if($brand == 1)

$output .= " \t " . $row->mfgName;

if($upc == 1)

$output .= " \t " . "Not Supported";

if($manufacturer_id == 1)

$output .= " \t " . "Not Supported";

if($product_type == 1)

{

$catNameTemp = strtolower($catName);

if($catNameTemp == "books")

$productTypeOut = "book";

else if($catNameTemp == "music")

$productTypeOut = "music";

else if($catNameTemp == "videos")

$productTypeOut = "video";

else

$productTypeOut = "other";

 

$output .= " \t " . $productTypeOut;

}

if($currency == 1)

$output .= " \t " . $default_currency;

if($feed_language == 1)

$output .= " \t " . $default_feed_language;

if($ship_to == 1)

$output .= " \t " . $default_ship_to;

if($ship_from == 1)

$output .= " \t " . $default_ship_from;

}

$output .= " \n";

}

$already_sent[$row->id] = 1;

$loop_counter++;

if ($loop_counter>750) {

$fp = fopen( $OutFile , "a" );

$fout = fwrite( $fp , $output );

fclose( $fp );

$loop_counter = 0;

$output = "";

}

}

 

$fp = fopen( $OutFile , "a" );

$fout = fwrite( $fp , $output );

fclose( $fp );

echo "File completed: " . $destination_file . "<br>\n";

chmod($OutFile, 0777);

//Start FTP to Froogle

 

function ftp_file( $ftpservername, $ftpusername, $ftppassword, $ftpsourcefile, $ftpdirectory, $ftpdestinationfile )

{

// set up basic connection

$conn_id = ftp_connect($ftpservername);

if ( $conn_id == false )

{

echo "FTP open connection failed to $ftpservername <BR>\n" ;

return false;

}

 

// login with username and password

$login_result = ftp_login($conn_id, $ftpusername, $ftppassword);

 

// check connection

if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has failed!<BR>\n";

echo "Attempted to connect to " . $ftpservername . " for user " . $ftpusername . "<BR>\n";

return false;

} else {

echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "<BR>\n";

}

 

if ( strlen( $ftpdirectory ) > 0 )

{

if (ftp_chdir($conn_id, $ftpdirectory )) {

echo "Current directory is now: " . ftp_pwd($conn_id) . "<BR>\n";

} else {

echo "Couldn't change directory on $ftpservername<BR>\n";

return false;

}

}

 

ftp_pasv ( $conn_id, true ) ;

// upload the file

$upload = ftp_put( $conn_id, $ftpdestinationfile, $ftpsourcefile, FTP_ASCII );

 

// check upload status

if (!$upload) {

echo "$ftpservername: FTP upload has failed!<BR>\n";

return false;

} else {

echo "Uploaded " . $ftpsourcefile . " to " . $ftpservername . " as " . $ftpdestinationfile . "<BR>\n";

}

 

// close the FTP stream

ftp_close($conn_id);

 

return true;

}

 

ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $source_file, $ftp_directory, $destination_file);

 

//End FTP to Froogle

 

// End TIMER

// ---------

$etimer = explode( ' ', microtime() );

$etimer = $etimer[1] + $etimer[0];

echo '<p>';

printf( "Script timer: <b>%f</b> seconds.", ($etimer-$stimer) );

echo '</p>';

// ---------

 

?>

 

What the heck am I doing wrong????

Link to comment
Share on other sites

Never mind, I figured it out.. "feeds" directory was "Feeds" fixed that, it works.

BUT I have another problem... Ok, the froogle_feed_file.txt is generating the link for froogle feed as:

 

http://www.lil-raskals.com/product_info ... cts_id=208 <---does not work

 

The url for the product is:

http://www.lil-raskals.com/catalog/prod ... cts_id/208 <---does work

 

does this for every item. How do I change the path for this to point to the right location?

 

ALSO....

when I run the feed in admin everything works, so it says, and it uploads to google base. when I goto my google/froogle account it never shows up. I had to manually take the .txt file that was generated and upload it through the froogle website. I did not think I should have to do this with this contrib. Does anyone else have this problem.

 

Thanks

Link to comment
Share on other sites

  • 3 months later...
Never mind, I figured it out.. "feeds" directory was "Feeds" fixed that, it works.

BUT I have another problem... Ok, the froogle_feed_file.txt is generating the link for froogle feed as:

 

http://www.lil-raskals.com/product_info ... cts_id=208 <---does not work

 

The url for the product is:

http://www.lil-raskals.com/catalog/prod ... cts_id/208 <---does work

 

does this for every item. How do I change the path for this to point to the right location?

 

ALSO....

when I run the feed in admin everything works, so it says, and it uploads to google base. when I goto my google/froogle account it never shows up. I had to manually take the .txt file that was generated and upload it through the froogle website. I did not think I should have to do this with this contrib. Does anyone else have this problem.

 

Thanks

 

 

Did anyone ever figure this one out? When I run the feed in the admin everything uploads to google base fine, but when I go in my google/froogle account it never shows up either. How do I know if it uploaded properly?

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...