Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Automatically send data feed to Froogle


gottaloveit

Recommended Posts

hi

 

my files get uploaded to froogle and it says after a while on base dashboard.Processed: 7893 Inserted: 7893.But the active items are only 3772. Cant seem to figure out why.

 

Kind regards

 

nafri

Link to comment
Share on other sites

  • Replies 3.7k
  • Created
  • Last Reply

Hi - I just had a glance through the last few pages but to be honest this thread is almost 100 pages long and I don't really know where to start!! I get the following error mesage:

 

Warning: fopen(http://www.highsports.co.uk/catalog/feeds/hsbase.txt) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/fhlinux176/h/highsports.co.uk/user/htdocs/catalog/admin/googlefeeder.php on line 313

 

Warning: fwrite(): supplied argument is not a valid stream resource in /home/fhlinux176/h/highsports.co.uk/user/htdocs/catalog/admin/googlefeeder.php on line 314

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/fhlinux176/h/highsports.co.uk/user/htdocs/catalog/admin/googlefeeder.php on line 315

 

Warning: fopen(http://www.highsports.co.uk/catalog/feeds/hsbase.txt) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/fhlinux176/h/highsports.co.uk/user/htdocs/catalog/admin/googlefeeder.php on line 321

 

Warning: fwrite(): supplied argument is not a valid stream resource in /home/fhlinux176/h/highsports.co.uk/user/htdocs/catalog/admin/googlefeeder.php on line 322

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/fhlinux176/h/highsports.co.uk/user/htdocs/catalog/admin/googlefeeder.php on line 323

File completed: hsbase.txt

 

Warning: chmod() [function.chmod]: No such file or directory in /home/fhlinux176/h/highsports.co.uk/user/htdocs/catalog/admin/googlefeeder.php on line 325

 

Is this something that is disable on my server and is stopping some of the functions such as fwrite working?

 

Thanks in advance!

Link to comment
Share on other sites

Hi I am a NEWBI

 

It seems your Froogle Exporter has a different attribute format to froogle its self.

 

Froogle Format is the following and can be found on

http://www.google.com/base/formattinginstr...&country=GB

 

a b C D E

1 title description link price

2

 

yours is some what different thus its not working and NEWBIs like me have no idea in the world how to fix this

 

Please advice me

 

Kevin

Link to comment
Share on other sites

FYI

 

I belive this my be incorrect now

 

# html_escaped=YES

# updates_only=NO

# product_type=OTHER

# quoted=YES

 

Is no longer required and will not work if its there

 

Please confirm my findings

 

Kevin

Link to comment
Share on other sites

  • 2 weeks later...

I uploaded the file several times with no success. The last time I opened the file and saw an extra return character at the end of the file. Deleted that last return character and uploaded the file manually to Google Base. This time 'Success'.

Is it possible to modify the googlefeeder.php to eliminate this last return?

Also there is an extra space at the end of each line. No problems with that for now, but you never know.

 

Thanks

Link to comment
Share on other sites

It doesn't look like there's anyone supporting this, but what the hey.

 

After a database reinstall which assigned a new IP, I updated the googlefeeder.php file in the admin directory with the new IP, username, password, and database name. However, when I attempt to connect it says it cannot connect my new username with the old IP. I've triple checked the settings and the new IP is correct.

 

Any ideas?

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

first of all, thanks for this great contriubution! hopefully it will bring much needed business my way!!!

 

i have installed the contribution, following the instructions as far as i am aware. but when i try to run the googlefeeder after de-commenting the ftp line i get an error saying :

 

FTP connection has failed!

Attempted to connect to uploads.google.com for user CHANGEME-googleFTP-username

 

where do i get the ftp user name from google? i have only followed the basic instructions.

 

any help will be awesome.

 

thanks

 

euan

Link to comment
Share on other sites

Hi,

 

first of all, thanks for this great contriubution! hopefully it will bring much needed business my way!!!

 

i have installed the contribution, following the instructions as far as i am aware. but when i try to run the googlefeeder after de-commenting the ftp line i get an error saying :

 

FTP connection has failed!

Attempted to connect to uploads.google.com for user CHANGEME-googleFTP-username

 

where do i get the ftp user name from google? i have only followed the basic instructions.

 

any help will be awesome.

 

thanks

 

euan

Link to comment
Share on other sites

sorry to sound like a complete numpty but where is the data feeds tab? on the google base website?

 

cheers

 

 

forget that, found it. but now its saying that the ftp connection is still failing. i put the user name and pass i created in the google_feeder.php but it dont seam to like it.

 

any ideas?

 

cheers

Link to comment
Share on other sites

thats it connected now.

 

thanks for a great contrubution guys!

 

advice to anyone going to add this: when you create an FTP account with google, wait an hour or so before you try and connect to it.

 

awesome

 

euan

Link to comment
Share on other sites

  • 2 weeks later...

Hello

I want to add two more columns to this script and i don't know how to do it..

 

the colums are products_ISBN to be isbn in google.

 

and products_author to be brand

 

I don't know how to do this.. I dont' understand the code enough.

thank you for your help

Naomi

Link to comment
Share on other sites

i want to install this contribution but my store is installed on a windows server and it is not possible to change it over to linux i have checked the permissions on the folder in which i want the feeds which is 700 will this allow me to write the feed to it.

Link to comment
Share on other sites

  • 1 month later...

Hi

 

I am getting this error

 

: SQL error MySQL client ran out of memory| sql = SELECT concat( 'CHANGEME-http://www.yourwebsite.com/product_info.php?products_id=' ,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) * 1,2) AS price, CONCAT( 'CHANGEME-http://www.yourwebsite.com/yourimagesdirectory/' ,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

 

Can any one help ?

 

Thanks

Link to comment
Share on other sites

  • 1 month later...
Am i the only one that has the product titles with missing spaces?

 

I'm having the same/similar problem.

 

The file is generated correctly but doesn't upload, seems like it times out.

 

When I manually upload the file and click on the link from the Google Base website the URL doesn't show up as "product_info.php?products_id=" it shows up as the product title and the "productid" number at the end.

Link to comment
Share on other sites

Dear All,

 

I have tried to install Google Feeder 1.20 and can't seem to get it to work. I have triple checked all the settings as detailed in the readme file, and Im confident I have them as they should be. I do already have Header Tags SEO contribution installed and working fine.

 

When I browse to the file http://www.ladiesoflove.co.uk/admin/googlefeeder.php I get the following error, and by output file remains blank.

 

 

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(">" => "> ", "®" => "", "?" => "", "™" => "", "?"=> "", "\t" => "", " " => ""); if ( file_exists( $OutFile ) ) unlink( $OutFile ); $output = "brand\tcondition\tlink\ttitle\tdescription\texpiration_date\tprice\timage_link\tproduct_type\tid"; //create optional section if($optional_sec == 1) { if($shipping == 1) $output .= "\tshipping"; if($pickup == 1) $output .= "\tpickup"; if($price_type == 1) $output .= "\tprice_type"; if($payment_accepted == 1) $output .= "\tpayment_accepted"; if($payment_notes == 1) $output .= "\tpayment_notes"; if($model_number == 1) $output .= "\tmodel_number"; if($feed_quantity == 1) $output .= "\tquantity"; if($tax_percent == 1) $output .= "\ttax_percent"; if($tax_region == 1) $output .= "\ttax_region"; } $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 && $feed_quantity == 1) ) { if($convertCur) { $row->price = ereg_replace("[^.0-9]", "", $row->price); $row->price = $row->price * $row3->curUSD; $row->price = number_format($row->price, 2, '.', ','); } //SEO Link Translation Logic: Edit as Neccessary $productURL=""; if($SEO_FLAG) { $string = ereg_replace("[^a-zA-Z0-9 ]", "", $row->name); $string = ereg_replace(' ', ' ', $string); $string = ereg_replace(' ', '-', strtolower($string)); $productURL = $catalogURL . $string . "-p-" . $row->id . ".html"; } else { $productURL = $row->product_url; } $output .= $row->mfgName . "\t" . $productCondition . "\t" . $productURL . "\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" . $feed_exp_date . "\t" . $row->price . "\t" . $row->image_url . "\t" . $catIndex[$row->prodCatID] . "\t" . $row->id; //optional values section if($optional_sec == 1) { if($shipping == 1) $output .= "\t" . $flatShipping; if($pickup == 1) $output .= "\t" . $pickup_value; if($price_type == 1) $output .= "\t" . $price_type_value; if($payment_accepted == 1) $output .= "\t" . $default_payment_methods; if($payment_notes == 1) $output .= "\t" . $payment_notes_text; if($model_number == 1) $output .= "\t" . $row->prodModel; if($feed_quantity == 1) $output .= "\t" . $row->quantity; if($tax_percent == 1) $output .= "\t" . $tax_percent_additonal_value; if($tax_region == 1) $output .= "\t" . $tax_region_value; } $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 . "

\n"; chmod($OutFile, 0777); //Start FTP 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

\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!

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

\n"; return false; } else { echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "

\n"; } if ( strlen( $ftpdirectory ) > 0 ) { if (ftp_chdir($conn_id, $ftpdirectory )) { echo "Current directory is now: " . ftp_pwd($conn_id) . "

\n"; } else { echo "Couldn't change directory on $ftpservername

\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!

\n"; return false; } else { echo "Uploaded " . $ftpsourcefile . " to " . $ftpservername . " as " . $ftpdestinationfile . "

\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 // End TIMER // --------- $etimer = explode( ' ', microtime() ); $etimer = $etimer[1] + $etimer[0]; echo '

 

'; printf( "Script timer: %f seconds.", ($etimer-$stimer) ); echo '

'; // --------- ?>

 

 

 

 

I have spent most of the day trying to find the error, Please help me before I pull all my hair out.

 

All the best,

 

Phil

Link to comment
Share on other sites

Dear All,

 

I have tried to install Google Feeder 1.20 and can't seem to get it to work. I have triple checked all the settings as detailed in the readme file, and Im confident I have them as they should be. I do already have Header Tags SEO contribution installed and working fine.

 

When I browse to the file http://www.ladiesoflove.co.uk/admin/googlefeeder.php I get the following error, and by output file remains blank.

 

 

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(">" => "> ", "®" => "", "?" => "", "™" => "", "?"=> "", "\t" => "", " " => ""); if ( file_exists( $OutFile ) ) unlink( $OutFile ); $output = "brand\tcondition\tlink\ttitle\tdescription\texpiration_date\tprice\timage_link\tproduct_type\tid"; //create optional section if($optional_sec == 1) { if($shipping == 1) $output .= "\tshipping"; if($pickup == 1) $output .= "\tpickup"; if($price_type == 1) $output .= "\tprice_type"; if($payment_accepted == 1) $output .= "\tpayment_accepted"; if($payment_notes == 1) $output .= "\tpayment_notes"; if($model_number == 1) $output .= "\tmodel_number"; if($feed_quantity == 1) $output .= "\tquantity"; if($tax_percent == 1) $output .= "\ttax_percent"; if($tax_region == 1) $output .= "\ttax_region"; } $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 && $feed_quantity == 1) ) { if($convertCur) { $row->price = ereg_replace("[^.0-9]", "", $row->price); $row->price = $row->price * $row3->curUSD; $row->price = number_format($row->price, 2, '.', ','); } //SEO Link Translation Logic: Edit as Neccessary $productURL=""; if($SEO_FLAG) { $string = ereg_replace("[^a-zA-Z0-9 ]", "", $row->name); $string = ereg_replace(' ', ' ', $string); $string = ereg_replace(' ', '-', strtolower($string)); $productURL = $catalogURL . $string . "-p-" . $row->id . ".html"; } else { $productURL = $row->product_url; } $output .= $row->mfgName . "\t" . $productCondition . "\t" . $productURL . "\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" . $feed_exp_date . "\t" . $row->price . "\t" . $row->image_url . "\t" . $catIndex[$row->prodCatID] . "\t" . $row->id; //optional values section if($optional_sec == 1) { if($shipping == 1) $output .= "\t" . $flatShipping; if($pickup == 1) $output .= "\t" . $pickup_value; if($price_type == 1) $output .= "\t" . $price_type_value; if($payment_accepted == 1) $output .= "\t" . $default_payment_methods; if($payment_notes == 1) $output .= "\t" . $payment_notes_text; if($model_number == 1) $output .= "\t" . $row->prodModel; if($feed_quantity == 1) $output .= "\t" . $row->quantity; if($tax_percent == 1) $output .= "\t" . $tax_percent_additonal_value; if($tax_region == 1) $output .= "\t" . $tax_region_value; } $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 . "

\n"; chmod($OutFile, 0777); //Start FTP 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

\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!

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

\n"; return false; } else { echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "

\n"; } if ( strlen( $ftpdirectory ) > 0 ) { if (ftp_chdir($conn_id, $ftpdirectory )) { echo "Current directory is now: " . ftp_pwd($conn_id) . "

\n"; } else { echo "Couldn't change directory on $ftpservername

\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!

\n"; return false; } else { echo "Uploaded " . $ftpsourcefile . " to " . $ftpservername . " as " . $ftpdestinationfile . "

\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 // End TIMER // --------- $etimer = explode( ' ', microtime() ); $etimer = $etimer[1] + $etimer[0]; echo '

 

'; printf( "Script timer: %f seconds.", ($etimer-$stimer) ); echo '

'; // --------- ?>

 

 

 

 

I have spent most of the day trying to find the error, Please help me before I pull all my hair out.

 

All the best,

 

Phil

 

 

can you paste your googlefeeder.php code (without the obvious server / password info) - i am unable to run your feed as it is protected with a username / password - from your code above it appears there may be a missing semicolon, or a missing quote at the end of a variable declaration, i have installed 1.2 and got it working ok except that i want it to upload more than one image and that that image should be the BIGGER one and not the small one, i will fix this soon. (i have ultimate seo installed too)

Link to comment
Share on other sites

can you paste your googlefeeder.php code (without the obvious server / password info) - i am unable to run your feed as it is protected with a username / password - from your code above it appears there may be a missing semicolon, or a missing quote at the end of a variable declaration, i have installed 1.2 and got it working ok except that i want it to upload more than one image and that that image should be the BIGGER one and not the small one, i will fix this soon. (i have ultimate seo installed too)

 

 

Many thanks for assistance Chris.

 

I have search through the coding and cant find the error. I haven't made any alterations to the file other than to add my details. I am using the amended googlefeeder file listed above the 1.20 download.

 

GOOGLEFEEDER FILE

 

<?php

// Title: Google Base / Froogle Data Feeder 1.20

// Author: Calvin K

// Contact: [email protected]

// Organization: Conceptual Networking

// Last Update: 2/20/07

 

// Start TIMER

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

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

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

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

 

//START Required Configuration

 

$OutFile = "../feeds/google_data_feed.txt";

$destination_file = "google_data_feed.txt";

$source_file = $OutFile; $catalogURL = 'http://www.ladiesoflove.co.uk/';

$imageURL = 'http://www.ladiesoflove.co.uk/images/';

$productURL = 'http://ladiesoflove.co.uk/product_info.php?products_id=';

$already_sent = array();

 

$home = "localhost" ;

$user="**********";

$pass="**********";

$base="**********";

 

$ftp_server = "uploads.google.com" ;

$ftp_user_name = "**********";

$ftp_user_pass = "**********";

$ftp_directory = ""; // leave blank

 

$productCondition = "New";

 

//END Required Configuration

 

 

//START Optional Advance Configuration

 

$SEO_FLAG = false;

 

//Monetary Adjustments for Products in Feed

$taxRate = 0; //default = 0 (e.g. for 17.5% tax use "$taxRate = 17.5;")

$taxCalc = ($taxRate/100) + 1; //Do not edit

$convertCur = true; //default = false

$curType = "GBP"; // Converts Currency to any defined currency (eg. USD, EUR, GBP)

if($convertCur)

{

$productURL = "http://ladiesoflove.co.uk/product_info.php?currency=" . $curType . "&products_id="; //where CURTYPE is your currency type (eg. USD, EUR, GBP)

}

 

//END Optional Advance Configuration

 

 

//START Optional Advance Feed Attributes

 

//(0=False 1=True) (optional_sec must be enabled to use any options)

$optional_sec = 0;

$shipping = 0;

$flatShipping = ""; //this is not binary. Custom Code is required to provide the shipping cost per product. ###needs to be an array for per product.

$pickup = 0;

$pickup_value = "false"; //true or false only.

$price_type = 0;

$price_type_value = ""; //negotiable or starting.

$payment_accepted = 0;

$default_payment_methods = ""; //Acceptable values: cash, check, GoogleCheckout, Visa, MasterCard, AmericanExpress, Discover, wiretransfer

$payment_notes = 0;

$payment_notes_text = ""; //payment policy text

$model_number = 0; //this is for the manufacturer model number, NOT your internal store sku

$feed_quantity = 0;

$tax_percent = 0;

$tax_percent_additonal_value = 0; //default = 0 (e.g. for 17.5% tax use "$tax_percent_additonal_value = 17.5;") Please note that this is tax in addition to the taxRate set above. If the taxRate set above is 0%, then this is your full tax rate for your region.

$tax_region = 0;

$tax_region_value = "";

 

//END Optional Advance Feed Attributes

 

 

 

$feed_exp_date = date('Y-m-d', time() + 2592000 );

 

 

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(">" => "> ", "®" => "", "?" => "", "™" => "", "?" => "", "t" => "", " " => "");

 

if ( file_exists( $OutFile ) )

unlink( $OutFile );

 

$output = "brand\tcondition\tlink\ttitle\tdescription\texpiration_date\tprice\timage_link\tproduct_type\tid";

 

//create optional section

if($optional_sec == 1)

{

if($shipping == 1)

$output .= "\tshipping";

if($pickup == 1)

$output .= "\tpickup";

if($price_type == 1)

$output .= "\tprice_type";

if($payment_accepted == 1)

$output .= "\tpayment_accepted";

if($payment_notes == 1)

$output .= "\tpayment_notes";

if($model_number == 1)

$output .= "\tmodel_number";

if($feed_quantity == 1)

$output .= "\tquantity";

if($tax_percent == 1)

$output .= "\ttax_percent";

if($tax_region == 1)

$output .= "\ttax_region";

}

$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 && $feed_quantity == 1) )

{

 

if($convertCur)

{

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

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

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

}

 

//SEO Link Translation Logic: Edit as Neccessary

$productURL="";

if($SEO_FLAG)

{

$string = ereg_replace("[^a-zA-Z0-9 ]", "", $row->name);

$string = ereg_replace(' ', ' ', $string);

$string = ereg_replace(' ', '-', strtolower($string));

 

$productURL = $catalogURL . $string . "-p-" . $row->id . ".html";

}

else

{

$productURL = $row->product_url;

}

 

$output .=

$row->mfgName . "\t" .

$productCondition . "\t" .

$productURL . "\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" .

$feed_exp_date . "\t" .

$row->price . "\t" .

$row->image_url . "\t" .

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

$row->id;

 

//optional values section

if($optional_sec == 1)

{

if($shipping == 1)

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

if($pickup == 1)

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

if($price_type == 1)

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

if($payment_accepted == 1)

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

if($payment_notes == 1)

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

if($model_number == 1)

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

if($feed_quantity == 1)

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

if($tax_percent == 1)

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

if($tax_region == 1)

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

}

$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

 

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

 

 

// 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>';

// ---------

 

?>

 

END GOOGLEFEEDER FILE

 

Thanks again,

 

Phillip

Link to comment
Share on other sites

Phillip,

 

Differences between your code and mine

 

you - $source_file = $OutFile; $catalogURL = 'http://www.ladiesoflove.co.uk/';

 

Me - $source_file = $OutFile;

 

$catalogURL = 'http://www.fireplace2u.co.uk/catalog/'; (2 seperate lines)

 

You - seo_flag=false;

me - seo_flag=true; (i have ultimate seo installed)

 

You - $_cleaner_array = array(">" => "> ", "®" => "", "?" => "", "™" => "", "?" => "", "t" => "", " " => "");

Me - $_cleaner_array = array(">" => "> ", "®" => "", "?" => "", "™" => "", "?"=> "", "\t" => "", " " => "");

 

 

i have also disable auto upload of feed and choose to manually upload, but your error occurs wel before that, there are a few difference above, change those and see how it goes.

Link to comment
Share on other sites

PLEASE IGNORE THAT PREVIOUS MESSAGE

 

Thanks Chris

 

I have made those small changes, but still I have the error. I'm at a loss as to what is causing this.

 

I have other contributions installed, some that have altered the database. I will next check to see that all the database tables are still named the same, otherwise, does anyone else have any ideas?

 

Many Thanks,

 

Phil

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...