Guest Posted November 13, 2004 Share Posted November 13, 2004 (edited) In the path to $Outfile, don't include the http://www.stuff . Just put the path to the file - - remember, it's not a web browser that's reading the value of $Outfile, it's the server itself. The server just needs to know where, on its local filesystem, to put the file. -jared Edited November 13, 2004 by jcall Quote Link to comment Share on other sites More sharing options...
scooperman Posted November 13, 2004 Share Posted November 13, 2004 Problem was with a comma in the number. VERY ungracefully coded, 30 second fix; # ADDED TO INCREASE PRICE BY 17.5% ########## $row->price = str_replace(',', '', $row->price); $row->price = number_format(($row->price * 1.175), 2); ##################################### <{POST_SNAPBACK}> Ok - that works fine and dandy. Thanks very much indeed. Quote Link to comment Share on other sites More sharing options...
Pixxi Posted November 13, 2004 Share Posted November 13, 2004 Has anyone been able to connect to hedwig.google.com via ftp in the last week or so? I'm finding all attempts are timing out but the server is responding to pings. Quote Link to comment Share on other sites More sharing options...
Pixxi Posted November 13, 2004 Share Posted November 13, 2004 hmm. froogle seems to display the symbols, i used fine. if we can figure out the pattern for the symbol code, we can get rid of them. for a quote on our feeds (") on our feeds it is """ without the quotes. <{POST_SNAPBACK}> There's a listing of special characters and symbol codes Here. Quote Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 13, 2004 Share Posted November 13, 2004 Give this a try and let me know what happens, and I'll incorporate it into Froogle Data Feeder v1.6. Tentative Fix for Special Characters: Insert: $_cleaner_array = array(">" => "> ", "®" => "", "™" => ""); After: $_strip_search = array( "![\t ]+$|^[\t ]+!m", // remove leading/trailing space chars '%[\r\n]+%m'); // remove CRs and newlines $_strip_replace = array( '', ''); Find these similar lines and replace with: 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" . Let me know what happens. Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
cdi-buy.com Posted November 17, 2004 Share Posted November 17, 2004 I'm completely lost when it comes to the ftp/cron/etc part of the deal...I have no idea what this means: 9) Insert The Cron Entry (Optional: For Automated Weekly Upload) 0 4 * * 3 /usr/bin/php -q /home/<unix route to your file>/admin/froogle.php Quote Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 17, 2004 Share Posted November 17, 2004 if you run a linux server, then you can use a cron entry to schedule when the feeder runs and submits a feed to froogle. do a search in this thread for more info. has anyone tried that code, for stripping special char? once a few ppl verify it, i'll release it in v1.60. Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
perler Posted November 17, 2004 Share Posted November 17, 2004 ok, stayed up a bit to get the code done. i just have to write the documentation for it. it now does it at a much higher speed and in 1 line of code (minus the one line to ask for the tax rate (VAT). <{POST_SNAPBACK}> ok, i dont want to push you, but, how far have you come with the VAT code? could you release the code here, so that i can incooperate it by hand while you prepare a new release? thanks, PAT Quote Link to comment Share on other sites More sharing options...
cdi-buy.com Posted November 17, 2004 Share Posted November 17, 2004 if you run a linux server, then you can use a cron entry to schedule when the feeder runs and submits a feed to froogle. do a search in this thread for more info. My host uses cPanel. I found how to do cron jobs but how do we know what the full path to the file is to go between the < > ? Quote Link to comment Share on other sites More sharing options...
jon_l Posted November 17, 2004 Share Posted November 17, 2004 Great mod, worked a treat and I now have my feed live of Froogle. A few things.... 1) My feed was originally rejected by Froogle as it contained 'image not available' images. Apparently, if a product doesn't have a proper image the field should be left blank. Is it worth putting something in the code to handle this? 2) I fixed the VAT issue ok. I see its possible this might be addressed in the code. If so, could I suggest it be done by adding a 'target country' field. This would then be used by the code to get the correct VAT rates from the database and apply it correctly. This would enable the code to be used to generate feeds for different countries, and takes varying VAT rates in to account. I think that was it. Thanks again for the mod. Jon. Quote Link to comment Share on other sites More sharing options...
perler Posted November 19, 2004 Share Posted November 19, 2004 2) I fixed the VAT issue ok. <{POST_SNAPBACK}> how did you fix it? i still have rounding errors in my froogle output.. PAT Quote Link to comment Share on other sites More sharing options...
clarocque Posted November 19, 2004 Share Posted November 19, 2004 Give this a try and let me know what happens, and I'll incorporate it into Froogle Data Feeder v1.6. Tentative Fix for Special Characters: Insert: $_cleaner_array = array(">" => "> ", "®" => "", "™" => ""); After: $_strip_search = array( "![\t ]+$|^[\t ]+!m", // remove leading/trailing space chars '%[\r\n]+%m'); // remove CRs and newlines $_strip_replace = array( '', ''); Find these similar lines and replace with: 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" . Let me know what happens. <{POST_SNAPBACK}> Sorry it took me so long to test, I never got notice that the forums has been updated for some reason - anyway - when I tried it did not strip ? or ?.... not sure if any one else got it to work - I believe I did the update correct... ??? Any othere thoughts? Quote osC Contributions I have published. Note: Some I only provided minor changes, updates or additions! Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 19, 2004 Share Posted November 19, 2004 i haven't had time to test it personally, but could you copy and paste part of your feed that has the symbols? Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 19, 2004 Share Posted November 19, 2004 (edited) sorry for the delay... i'm not digging this "delayed notification" from osC forums. i should turn it off. here's the official code for tax/vat support. it does not pull from the database yet. i'll release 1.6 once we resolve the funky symbol problem. donations are always welcome. paypal: [email protected] there's just an extra line for you to fill in your tax rate: $taxRate = 0; //default = 0 (e.g. for 17.5% tax use "$taxRate = 17.5;") <?php // ?Start TIMER // ?----------- $stimer = explode( ' ', microtime() ); $stimer = $stimer[1] + $stimer[0]; // ?----------- $OutFile = "../feeds/your-fr-outfile.txt"; //"CHANGEME-full-path-to-file-with-777-dir-and-file-permissions.fr-outfile.txt"; $destination_file = "your-fr-outfile.txt"; ?//"CHANGEME-filename-to-upload-to-froogle.txt"; $source_file = $OutFile; $imageURL = 'CHANGEME-http://www.yourwebsite.com/yourimagesdirectory/'; $productURL = 'CHANGEME-http://www.yourwebsite.com/product_info.php?products_id='; $already_sent = array(); $home = "localhost"; $user="CHANGEME-sql-db-user"; $pass="CHANGEME-sql-db-user-password"; $base="CHANGEME-name-of-sql-database"; $ftp_server = "hedwig.google.com"; $ftp_user_name = "CHANGEME-froogle-username"; $ftp_user_pass = "CHANGEME-froogle-password"; $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_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) ) ) 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( '', ''); 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 = $row->price * ?$row3->curUSD; ? $row->price = number_format($row->price, 2, '.', ''); ?} ?$output .= $row->product_url . "\t" . ?preg_replace($_strip_search, $_strip_replace, strip_tags( str_replace(">", "> ", $row->name) ) ) . "\t" . ?preg_replace($_strip_search, $_strip_replace, strip_tags( str_replace(">", "> ", $row->description) ) ) . "\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>'; // ?--------- ?> Edited November 19, 2004 by FlyingMonkey Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 19, 2004 Share Posted November 19, 2004 ack... ignore that code. it's some old version with a bug. ok, i've tested the remove symbol code... and it works fine. osC changes the symbol to it's original self too ?. so if you've edited your text it wouldn't work with the default. i designed so that ppl could edit it themselves to add more symbols. i'll put the official v1.6 with documentation up hopefully by this weekend. i have a 15 page paper and some other work, i need to finish first though. Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 19, 2004 Share Posted November 19, 2004 ***Official Release of Froogle Data Feeder v1.6 Final*** Released By: Calvin K ------------------------ Date: November 19, 2004 Description: Creates and automatically sends a data feed to Froogle, to provide product information and pictures. This Froogle Data Feeder, handles product duplicates, specials(if available), currency conversion, tax support, html descriptions, full category trees, and automatic upload. In addition, the Froogle Data Feeder supports advance feeds. With the advance feed option enabled and the "instock" field enabled, it will create a feed with all of the products. Without the advance feed option enabled, it will only submit in stock items. New Features: Tax/VAT Support Special Character Removal Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
clarocque Posted November 19, 2004 Share Posted November 19, 2004 i haven't had time to test it personally, but could you copy and paste part of your feed that has the symbols? <{POST_SNAPBACK}> Calvin, I have just added those to sumbals to the title and text::: product_url name description price image_url category http://127.0.0.1/private/v26x/product_info.php?products_id=1 Test? test? 4.00 http://127.0.0.1/dev/images/image1.jpg Category Not sure if that is what you meant??? Quote osC Contributions I have published. Note: Some I only provided minor changes, updates or additions! Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 21, 2004 Share Posted November 21, 2004 it's ok... i just took the time to make test cases on my own before you posted. version 1.6 that was released yesterday has the fix. Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
clarocque Posted November 21, 2004 Share Posted November 21, 2004 it's ok... i just took the time to make test cases on my own before you posted. version 1.6 that was released yesterday has the fix. <{POST_SNAPBACK}> Calvin - great job!!! I Appreciate - (sure others do too) So looking at it, if I need to add other special characters I would add them to this line of code: $_cleaner_array = array(">" => "> ", "®" => "", "?" => "", "™" => "", "?" => ""); correct? Thanks again! Chris Quote osC Contributions I have published. Note: Some I only provided minor changes, updates or additions! Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 21, 2004 Share Posted November 21, 2004 (edited) exactly! but the more that's in there... the slower the feed will run. so if you don't have certain ones... don't put them in there. also note that the symbols come in two different forms. as code and as the symbol itself, both have to be added. "®" => "", "?" => "", Edited November 21, 2004 by FlyingMonkey Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
henrygavin Posted November 21, 2004 Share Posted November 21, 2004 this is really greate contribution. but I have encountered one problem. my store supports two language, and I found the data feed mess up the two language for category info. any one got ideas? lots of thanks in advanced. Quote Link to comment Share on other sites More sharing options...
FlyingMonkey Posted November 21, 2004 Share Posted November 21, 2004 thank you for your kind words. the feeder pulls the the default language information. Quote Most likely your question has been answered, please do a search first. Link to comment Share on other sites More sharing options...
pglock Posted November 21, 2004 Share Posted November 21, 2004 I've just added the contrib to our site and sucessfully uploaded to froogle, note: this is the UK not the US version. Unfortunately, the feed had been rejected as 'Unrecognised feed'. I've checked that the output file is in the correct 'my_storename.txt' format. Any other ideas? Quote Link to comment Share on other sites More sharing options...
madyson3 Posted November 22, 2004 Share Posted November 22, 2004 hey john , thankx for replying this is what i have for the first line i even tried putting double .. in front of /temp the permission for public_html/temp/ = 777 the permission for my /public_html/temp/mghwor.txt/ = 777 thankyou <{POST_SNAPBACK}> Woo hoo. Worked for me too! B) Quote See you on the dark side, Kristy I'm just a girl living in captivity Your rules of thumb makes me worrisome Link to comment Share on other sites More sharing options...
madyson3 Posted November 22, 2004 Share Posted November 22, 2004 Okay maybe I'm a dumb bunny. I saw someone else with the same question, but I didn't see an answer. (Course could be the ole' ADD kicking in.) In the instructions you have: 10) Insert The Cron Entry (Optional: For Automated Weekly Upload) 0 4 * * 3 /usr/bin/php -q /home/<unix route to your file>/admin/froogle.php I'm sorry but I am not familiar with cron jobs or where to find my unix route. Can someone please help? I think this is a great contribution, and I'd really like to take advantage of the automated weekly feed. Thanks in advance. Quote See you on the dark side, Kristy I'm just a girl living in captivity Your rules of thumb makes me worrisome Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.