Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Automatically send data feed to Froogle


gottaloveit

Recommended Posts

I finished the instalation! YEA! I'm getting errors... BOOO!

I thought these errors looked like I didnt have my feeds file chmod 777, I checked, it is set at 777. So what causes these errors?

Warning: fopen(http://www.sweetdeal4u.biz/catalog/feeds/sweetdeal4u_biz.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/sweetd73/public_html/catalog/admin/froogle.php on line 293

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 294

Warning: fclose(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 295

Warning: fopen(http://www.sweetdeal4u.biz/catalog/feeds/sweetdeal4u_biz.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/sweetd73/public_html/catalog/admin/froogle.php on line 301

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 302

Warning: fclose(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 303
File completed: sweetdeal4u_biz.txt

Warning: chmod(): No such file or directory in /home/sweetd73/public_html/catalog/admin/froogle.php on line 305

Script timer: 0.364466 seconds.

 

My /admin/froogle.php looks like this. (passwords blocked out)

$OutFile = "http://www.sweetdeal4u.biz/catalog/feeds/sweetdeal4u_biz.txt"; //"CHANGEME-full-path-to-file-with-777-dir-and-file-permissions.fr-outfile.txt";
$destination_file = "sweetdeal4u_biz.txt";  //"CHANGEME-filename-to-upload-to-froogle.txt";
$source_file = $OutFile;
$imageURL = 'http://www.sweetdeal4u.biz/catalog/images/';
$productURL = 'http://www.sweetdeal4u.biz/catalog/product_info.php?products_id=';
$already_sent = array();

$home = "localhost";
$user="xxxxx";
$pass="xxxxxx";
$base="sweetd73_osc2";

$ftp_server = "hedwig.google.com";
$ftp_user_name = "[email protected]";
$ftp_user_pass = "xxxxxx";
$ftp_directory = ""; // leave blank for froogle

$taxRate = 0; //default = 0 (e.g. for 17.5% tax use "$taxRate = 17.5;")
$taxCalc = ($taxRate/100) + 1;  //Do not edit
$convertCur = false; //default = false
$curType = "USD"; // Converts Currency to any defined currency (eg. USD, EUR, GBP)
if($convertCur)
{
$productURL = "CHANGEME-http://www.yourwebsite.com/product_info.php?currency=" . $curType . "&products_id=";  //where CURTYPE is your currency type (eg. USD, EUR, GBP)
}

//START Advance Optional Values

//(0=False 1=True) (optional_sec must be enabled to use any options)
$optional_sec = 0;
$instock = 0;
$shipping = 0;
$lowestShipping = "4.95";  //this is not binary.
$brand = 0;
$upc = 0;   //Not supported by default osC
$manufacturer_id = 0;  //Not supported by default osC
$product_type = 0;
$currency = 0;
$default_currency = "USD";  //this is not binary.
$feed_language = 0;
$default_feed_language = "en";  //this is not binary.
$ship_to = 0;
$default_ship_to = "ALL"; //this is not binary, not supported by default osC for individual products.
$ship_from = 0;
$default_ship_from = "USD"; //this is not binary, not supported by default osC for individual products.

//END of Advance Optional Values

if (!($link=mysql_connect($home,$user,$pass)))
{
echo "Error when connecting itself to the data base";
exit();
}
if (!mysql_select_db( $base , $link ))
{
echo "Error the data base does not exist";
exit();
}

$sql = "
SELECT concat( '" . $productURL . "' ,products.products_id) AS product_url,
products_model AS prodModel, products_weight,
manufacturers.manufacturers_name AS mfgName,
manufacturers.manufacturers_id,
products.products_id AS id,
products_description.products_name AS name,
products_description.products_description AS description,
products.products_quantity AS quantity,
products.products_status AS prodStatus,
FORMAT( IFNULL(specials.specials_new_products_price, products.products_price) * " . $taxCalc . ",2) AS price,
CONCAT( '" . $imageURL . "' ,products.products_image) AS image_url,
products_to_categories.categories_id AS prodCatID,
categories.parent_id AS catParentID,
categories_description.categories_name AS catName
FROM categories,
categories_description,
products,
products_description,
products_to_categories

left join manufacturers on ( manufacturers.manufacturers_id = products.manufacturers_id )
left join specials on ( specials.products_id = products.products_id AND ( ( (specials.expires_date > CURRENT_DATE) OR (specials.expires_date = 0) ) AND ( specials.status = 1 ) ) )

WHERE products.products_id=products_description.products_id
AND products.products_id=products_to_categories.products_id
AND products_to_categories.categories_id=categories.categories_id
AND categories.categories_id=categories_description.categories_id
ORDER BY
products.products_id ASC
";


$catInfo = "
SELECT
categories.categories_id AS curCatID,
categories.parent_id AS parentCatID,
categories_description.categories_name AS catName
FROM
categories,
categories_description
WHERE categories.categories_id = categories_description.categories_id
";

function findCat($curID, $catTempPar, $catTempDes, $catIndex)
{
if( (isset($catTempPar[$curID])) && ($catTempPar[$curID] != 0) )
{
 if(isset($catIndex[$catTempPar[$curID]]))
 {
	 $temp=$catIndex[$catTempPar[$curID]];
 }
 else
 {
	 $catIndex = findCat($catTempPar[$curID], $catTempPar, $catTempDes, $catIndex);
	 $temp = $catIndex[$catTempPar[$curID]];
 }
}
if( (isset($catTempPar[$curID])) && (isset($catTempDes[$curID])) && ($catTempPar[$curID] == 0) )
{
 $catIndex[$curID] = $catTempDes[$curID];
}
else
{
 $catIndex[$curID] = $temp . " > " . $catTempDes[$curID];
}
return $catIndex;

}

$catIndex = array();
$catTempDes = array();
$catTempPar = array();
$processCat = mysql_query( $catInfo )or die( $FunctionName . ": SQL error " . mysql_error() . "| catInfo = " . htmlentities($catInfo) );
while ( $catRow = mysql_fetch_object( $processCat ) )
{
$catKey = $catRow->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(">" => "> ", "®" => "", "?" => "", "™" => "", "?" => "");

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: <a href=\"" . $OutFile . "\" target=\"_blank\">" . $destination_file . "</a><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 style="margin:auto; text-align:center">';
printf( "Script timer: <b>%f</b> seconds.", ($etimer-$stimer) );
echo '</p>';
//  ---------

?>

 

I think my question has taken a huge leap of intelagence when compared to my last one.

Link to comment
Share on other sites

I finished the instalation! YEA! I'm getting errors... BOOO!

I thought these errors looked like I didnt have my feeds file chmod 777, I checked, it is set at 777. So what causes these errors?

Warning: fopen(http://www.sweetdeal4u.biz/catalog/feeds/sweetdeal4u_biz.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/sweetd73/public_html/catalog/admin/froogle.php on line 293

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 294

Warning: fclose(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 295

Warning: fopen(http://www.sweetdeal4u.biz/catalog/feeds/sweetdeal4u_biz.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/sweetd73/public_html/catalog/admin/froogle.php on line 301

Warning: fwrite(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 302

Warning: fclose(): supplied argument is not a valid stream resource in /home/sweetd73/public_html/catalog/admin/froogle.php on line 303
File completed: sweetdeal4u_biz.txt

Warning: chmod(): No such file or directory in /home/sweetd73/public_html/catalog/admin/froogle.php on line 305

Script timer: 0.364466 seconds.

 

My /admin/froogle.php looks like this. (passwords blocked out)

$OutFile = "http://www.sweetdeal4u.biz/catalog/feeds/sweetdeal4u_biz.txt"; //"CHANGEME-full-path-to-file-with-777-dir-and-file-permissions.fr-outfile.txt";
$destination_file = "sweetdeal4u_biz.txt";  //"CHANGEME-filename-to-upload-to-froogle.txt";
$source_file = $OutFile;
$imageURL = 'http://www.sweetdeal4u.biz/catalog/images/';
$productURL = 'http://www.sweetdeal4u.biz/catalog/product_info.php?products_id=';
$already_sent = array();

$home = "localhost";
$user="xxxxx";
$pass="xxxxxx";
$base="sweetd73_osc2";

$ftp_server = "hedwig.google.com";
$ftp_user_name = "[email protected]";
$ftp_user_pass = "xxxxxx";
$ftp_directory = ""; // leave blank for froogle

$taxRate = 0; //default = 0 (e.g. for 17.5% tax use "$taxRate = 17.5;")
$taxCalc = ($taxRate/100) + 1;  //Do not edit
$convertCur = false; //default = false
$curType = "USD"; // Converts Currency to any defined currency (eg. USD, EUR, GBP)
if($convertCur)
{
$productURL = "CHANGEME-http://www.yourwebsite.com/product_info.php?currency=" . $curType . "&products_id=";  //where CURTYPE is your currency type (eg. USD, EUR, GBP)
}

//START Advance Optional Values

//(0=False 1=True) (optional_sec must be enabled to use any options)
$optional_sec = 0;
$instock = 0;
$shipping = 0;
$lowestShipping = "4.95";  //this is not binary.
$brand = 0;
$upc = 0;   //Not supported by default osC
$manufacturer_id = 0;  //Not supported by default osC
$product_type = 0;
$currency = 0;
$default_currency = "USD";  //this is not binary.
$feed_language = 0;
$default_feed_language = "en";  //this is not binary.
$ship_to = 0;
$default_ship_to = "ALL"; //this is not binary, not supported by default osC for individual products.
$ship_from = 0;
$default_ship_from = "USD"; //this is not binary, not supported by default osC for individual products.

//END of Advance Optional Values

if (!($link=mysql_connect($home,$user,$pass)))
{
echo "Error when connecting itself to the data base";
exit();
}
if (!mysql_select_db( $base , $link ))
{
echo "Error the data base does not exist";
exit();
}

$sql = "
SELECT concat( '" . $productURL . "' ,products.products_id) AS product_url,
products_model AS prodModel, products_weight,
manufacturers.manufacturers_name AS mfgName,
manufacturers.manufacturers_id,
products.products_id AS id,
products_description.products_name AS name,
products_description.products_description AS description,
products.products_quantity AS quantity,
products.products_status AS prodStatus,
FORMAT( IFNULL(specials.specials_new_products_price, products.products_price) * " . $taxCalc . ",2) AS price,
CONCAT( '" . $imageURL . "' ,products.products_image) AS image_url,
products_to_categories.categories_id AS prodCatID,
categories.parent_id AS catParentID,
categories_description.categories_name AS catName
FROM categories,
categories_description,
products,
products_description,
products_to_categories

left join manufacturers on ( manufacturers.manufacturers_id = products.manufacturers_id )
left join specials on ( specials.products_id = products.products_id AND ( ( (specials.expires_date > CURRENT_DATE) OR (specials.expires_date = 0) ) AND ( specials.status = 1 ) ) )

WHERE products.products_id=products_description.products_id
AND products.products_id=products_to_categories.products_id
AND products_to_categories.categories_id=categories.categories_id
AND categories.categories_id=categories_description.categories_id
ORDER BY
products.products_id ASC
";


$catInfo = "
SELECT
categories.categories_id AS curCatID,
categories.parent_id AS parentCatID,
categories_description.categories_name AS catName
FROM
categories,
categories_description
WHERE categories.categories_id = categories_description.categories_id
";

function findCat($curID, $catTempPar, $catTempDes, $catIndex)
{
if( (isset($catTempPar[$curID])) && ($catTempPar[$curID] != 0) )
{
 if(isset($catIndex[$catTempPar[$curID]]))
 {
	 $temp=$catIndex[$catTempPar[$curID]];
 }
 else
 {
	 $catIndex = findCat($catTempPar[$curID], $catTempPar, $catTempDes, $catIndex);
	 $temp = $catIndex[$catTempPar[$curID]];
 }
}
if( (isset($catTempPar[$curID])) && (isset($catTempDes[$curID])) && ($catTempPar[$curID] == 0) )
{
 $catIndex[$curID] = $catTempDes[$curID];
}
else
{
 $catIndex[$curID] = $temp . " > " . $catTempDes[$curID];
}
return $catIndex;

}

$catIndex = array();
$catTempDes = array();
$catTempPar = array();
$processCat = mysql_query( $catInfo )or die( $FunctionName . ": SQL error " . mysql_error() . "| catInfo = " . htmlentities($catInfo) );
while ( $catRow = mysql_fetch_object( $processCat ) )
{
$catKey = $catRow->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(">" => "> ", "®" => "", "?" => "", "™" => "", "?" => "");

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: <a href=\"" . $OutFile . "\" target=\"_blank\">" . $destination_file . "</a><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 style="margin:auto; text-align:center">';
printf( "Script timer: <b>%f</b> seconds.", ($etimer-$stimer) );
echo '</p>';
//  ---------

?>

 

I think my question has taken a huge leap of intelagence when compared to my last one.

Link to comment
Share on other sites

Okay, people, the main problem is that I am an idiot. I just deleted the problem entries and reentered them, and that works. But (duh) the feed puts new products at the bottom of the feed, not inserting them alphabetically. (Wow, do I feel stupid.) So a happy ending, I got the feed working correctly and my products are now on Froogle (yea). I guess I still have a question, is there any rhyme or reason to why some products screw up when creating the feed? I sell comic books, so I only have 1 or 2 of each comic in stock and will hopefully get many totally different comics on a regular basis, so it is a pain to have to enter the new comics, see which ones didn't make the feed correctly, delete them, reenter them, see if the feed is correct again, etc...

 

But great contribution, thanks

 

Hello, thanks for the contribution. I think that I am very, very close to getting it working. I have followed the instructions and uploaded froogle.php, created a data feed, uploaded the feed to froogle. However...

I have 630 products, and the feed created 610 of them correctly. (Froogle page says its a bad data feed because of 20 errors) 20 of the products, for some reason, are missing the product name and product description.

 

Since it was only 20 products I figured brute force and ignorance can solve the problem, just delete the bad 20 and re-enter them. I tried this with 2 products, but the datafeed is not updating for the new products. I tried fixing the bad products, deleting and re-entering the bad products, then just enterting a totally new test product not associated at all with any of the bad products. The data feed does not reflect any changes, or new products. I can delete products, but not change existing products or add ones.

 

I am not sure what to try, since it works (worked) for 610 of 630 products I am doing something correct, but possibly missing something. Any help would be appreciated. I can post any code anyone wants to look at, I triple checked it, so I think it is correct. I am one small step above a newbie, just a cut and paster in regards to code, so I can screw up code a whole lot easier than I can fix it. I have modified the OS Commerce, the only contribution that I can think of that would affect this is that I have small product images in the 'regular' images folder in OSCommerce, and I put larger images into a folder called large. It is not really a contribution, it is a line or two of code added so some file (I can't remember which file.)

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

OK I run

http://rainbowstop.com/flags/admin/froogle.php

 

I get the error below

: SQL error Table 'rainbow_peace.categories' doesn't exist| catInfo = SELECT categories.categories_id AS curCatID, categories.parent_id AS parentCatID, categories_description.categories_name AS catName FROM categories, categories_description WHERE categories.categories_id = categories_description.categories_id

 

I know the reason because there is no Table== categories the categories is flags_categores.

 

and I can't for the life of me figure out where to change the code to reflect that.

thank you

noppie

Link to comment
Share on other sites

I have no idea what I'm doing. Here are the errors I get

 

Warning: fopen(../feeds/aromatherapy_4_u.txt): failed to open stream: Permission denied in /var/www/html/catalog/admin/froogle.php on line 301

 

Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/html/catalog/admin/froogle.php on line 302

 

Warning: fclose(): supplied argument is not a valid stream resource in /var/www/html/catalog/admin/froogle.php on line 303

File completed: aromatherapy_4_u.txt

 

Warning: chmod(): Permission denied in /var/www/html/catalog/admin/froogle.php on line 305

 

Script timer: 0.095891 seconds.

 

Here is what those lines say

$fp = fopen( $OutFile , "a" );
$fout = fwrite( $fp , $output );
fclose( $fp );
echo "File completed: <a href=\"" . $OutFile . "\" target=\"_blank\">" . $destination_file . "</a><br>\n";
chmod($OutFile, 0777);

/*

 

I haven't gone past step 7 in the instructions because the file isn't being written properly.

 

Thanks I'm sure with your help I'll get there evenutally

Link to comment
Share on other sites

I was getting the same problem as you dandelion, I was able to fix it by doing the following:

 

1. I changed my /feeds/ directory from: http://mydomain.com/feeds/ to http://mydomain.com/catalog/feeds.

 

2. I also changed my file name in froogle.php from:

$OutFile = "http://mydomain.com/feeds/mydomain_com.txt";

 

to: $OutFile = "../feeds/mydomain_com.txt";

 

These two things made the difference for me, I hope it works for you. Good luck.

 

 

 

Neostorm

Link to comment
Share on other sites

Any ideas what would cause this? My line 3 is commented out

// ----------

 

here's the error I get in my web browser when loading the page:

Parse error: parse error in /Users/admin/Sites/catalog/admin/froogle.php on line 3

Link to comment
Share on other sites

I have a MOD that send me e-mails whenever there is an error on my site or someone tries to hack into the site, like try to get into the Admin.

 

For months now, I have been getting this e-mail when Google visits my site and sometimes MSNBot for various product pages and so on...

 

-------------------------------------------
Site: http://www.popthetop.com
Error Code: 404 - File or Page Not Found
Occurred: 08/28/2005 7:55:44
Requested URL: http://www.popthetop.com/catalog/product_info.php%3Fcurrency%3DUSD&products_id%3D324&fr=AM0D2pquQxgKeI9frlt5U5R8v6OCmDEu09vJmtrY-N41AAAAAAAAAAA
User IP Address: 66.249.65.66
User Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Referer: 
-------------------------------------------

 

As you can see, Google is trying to load pages that the links have converted = signs and question marks.

 

%3F is supposed to be ?

%3D is supposed to be =

 

If I turn

http://www.popthetop.com/catalog/product_info.php%3Fcurrency%3DUSD&products_id%3D324&fr=AM0D2pquQxgKeI9frlt5U5R8v6OCmDEu09vJmtrY-N41AAAAAAAAAAA

into this

http://www.popthetop.com/catalog/product_info.php?currency=USD&products_id=324&fr=AM0D2pquQxgKeI9frlt5U5R8v6OCmDEu09vJmtrY-N41AAAAAAAAAAA

The links work.

 

Is there any way to fix this so that the correct pages get loaded? Is there any way to convert %3F to ? and %3D to = when a page loads?

 

 

you can try urldecode and urlencode.... but it may just be that mod that's causing the issue.

 

http://www.carblitesolutions.com/feeds/carblitesolutions.txt displays the = and ? fine.

Most likely your question has been answered, please do a search first.

Link to comment
Share on other sites

Any ideas what would cause this?  My line 3 is commented out
// ----------

 

here's the error I get in my web browser when loading the page:

Parse error: parse error in /Users/admin/Sites/catalog/admin/froogle.php on line 3

 

It cannot be in between other block quotes like /* and */

Most likely your question has been answered, please do a search first.

Link to comment
Share on other sites

I have installed this on my website but can't get past this step:

7) Make sure the file is being written properly.

a. To run the feeder point your internet browser to http://www.yourwebsite.com/admin/froogle.php

b. Then point your browser to http://www.yourwebsite.com/feeds/your-fr-outfile.txt to check the feed.

 

When I try to point my browser to www.mywebsite.com/catalog/admin/froogle.php, it says page not found. Same as the second link check.

 

I did the optional add to admin part and tried creating the feed through admin and I get the same error, page not found. The files are uploaded to the proper directories so I have no idea why it isn't working.

 

Can someone shed some light?

 

Autumn

Link to comment
Share on other sites

Correct.  I enter my id and password, then it goes to the can not find server screen.

 

Try it without the "www"... you just need to match it up with where you placed it in your ftp. Also try installing the interface (since, it already knows where to point, if the installation is correct)

 

Anyways, i'll be gone for at least the next week. (gotta study)

Most likely your question has been answered, please do a search first.

Link to comment
Share on other sites

Hello,

 

 

the Froogle-Team have a problem with one of my products that price is 0.00 Eur because it's just a infoproduct for an product-option that costs from 5.00 to 6.50 Eur. In the shop you can't buy the infoproduct because i hide the price and 'Buy Now' - Button for products with an price at 0.00 Eur.

 

Now i had to open the froogle-data-feed 'per hand' and delete the product in order that the froogle-team accept the file.

 

Had anyone an idea what to do that the data feed only contain products with an price greater than 0.00 Eur

 

Sorry for my not so good english, i hope you understand what i mean.

 

best regards

Patrick

Captain: I thought you were going to upgrade this.

Trip: That is the upgrade.

Well, if you want, I can change the color.

Link to comment
Share on other sites

or outside of the <?php ?> tags.

 

Now I'm getting this...

 

 File completed: computertoystore-fr-outfile.txt
Connected to hedwig.google.com, for user computertoystore

Warning: ftp_put(): computertoystore-fr-outfile.txt: Permission denied on server. (Overwrite) in /Users/admin/Sites/catalog/admin/froogle.php on line 342
hedwig.google.com: FTP upload has failed!

 

I know for damn sure that my froogle FTP UID and password are correct in the file. I'm also fairly sure that the permissions on the php are correct. Could Froogle have changed my FTP password or access without telling me (since I have not used the account in a few months)? I AM able to log in to Froogle with no trouble and have no warnings.

 

Any other ides on what would cause this error message?

Link to comment
Share on other sites

Warning: ftp_put(): computertoystore-fr-outfile.txt: Permission denied on server. (Overwrite) in /Users/admin/Sites/catalog/admin/froogle.php on line 342

hedwig.google.com: FTP upload has failed![/code]

 

It looks like an Overwrite was denied. Hedwig won't let you upload the same file twice. You have to wait until Froogle's bots have sucked that file out of the directory and erased it.

 

You'll know when you have the right pw when you can upload files with a different name (froogle will just spit it out)

Link to comment
Share on other sites

It looks like an Overwrite was denied. Hedwig won't let you upload the same file twice. You have to wait until Froogle's bots have sucked that file out of the directory and erased it.

 

You'll know when you have the right pw when you can upload files with a different name (froogle will just spit it out)

 

It looks like you were right as it is working today. Silly me, trying to double check my work instead of just waiting a day!

Link to comment
Share on other sites

I have a few questions:

 

1. why in the listing of items for my store does the store name appear as my id instead of my store name = store:aromatherapy_4_u instead of Aromatherapy for You - how can I fix this?

 

2. in my descriptions some apostrophes have become question marks - how can this be corrected?

 

3. in some of my prduct titles the letter following an apostrophe has become capitalized (ie Nature'S) - how can I fix this?

 

4. some photos aren't showing up and they are larger then other ones that are showing

 

Thanks

Edited by dandelion
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...