Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

edgeoi feed error


liz0

Recommended Posts

I tried edgeoi feed mod, but it gave me the following errors:

 

 

The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

 

 

--------------------------------------------------------------------------------

 

Invalid at the top level of the document. Error processing resource 'http://www.crystalmood.com/admin/edgeio.php'. Line 1,...

 

HTTP/1.1 200 OK

 

 

 

No xml generated as well. Ideas? Thanks!

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Invalid at the top level of the document. Error processing resource 'http://www.crystalmood.com/admin/edgeio.php'. Line 1,...

 

HTTP/1.1 200 OK

 

I think it should be ...........admin/rss_edgeio.php

Kristine Running Wolf

Link to comment
Share on other sites

The problem might be inline 19:

$limit=' LIMIT 10'; //nice to limit number of posts for debug delete for production

 

If I change that number to ie 1000 or cancel it out I get

XML Parsing Error: not well-formed

Location: http://alaskakreations.com/feeds/google_feed.xml

Line Number 14834, Column 13: <g:upc>T&T</g:upc>

------------^

 

Any ideas, please?

Kristine Running Wolf

Link to comment
Share on other sites

no idea, here is my modified file, runs just great

 

<?php

/*

**********************************************************

*** Edgeio.com and googlebase feed - v. 1.0 (May '06) ***

**********************************************************

*by Andrew Yasinsky ([email protected])

*/

 

/*INCLUDE NEEDED OS COMMERCE CLASSES*/

require('includes/configure.php');

require(DIR_WS_FUNCTIONS . 'database.php');

tep_db_connect() or die('Unable to connect to database server!');

require(DIR_WS_FUNCTIONS . 'general.php');

/*END STOCK OS COMMERCE INCLUDE*/

 

$edgeio=false; //enable edge io

$googlebase=true; //enable google base

$dryrun=true; //whether or not execute actual upload to both or stop at file generation

$limit=' LIMIT 1000'; //nice to limit number of posts for debug delete for production

 

//CHANGE PARAMETERS BELOW///

$feedDirectory = "/www/x/x/mysite.com/htdocs/feeds/"; //"CHANGEME-full-path-to-file-with-777-dir-and-file-permissions.yahoo-outfile.txt";

$fileEdgeio="edgeio_feed.xml";

$fileGoogle="google_feed.xml";

$feedTitle='mysite'; //Feed Title

$feedDescription='mysite'; //Feed Title

$siteUrl='http://mysite.com'; //Site URL

$feedUrl='http://mysite.com/feeds/'; //URL to $OutFile

$imageUrl = 'http://mysite.com/images/'; //Base URL for images

$productUrl = 'http://mysite.com/product_info.php/products_id/'; //Base url for products could be products_info.php?products_id=XXX if you dont use mod rewrite

$language='en-us';

$currency='USD'; //ISO Currency code i.e. GBP, EUR

$locationCity='Central'; //location of the product

$locationState='AK';

$locationZip='99730';

$locationCountry='USA';

$ttl=60; //Time to expiration in days minimum 30 max 90

$paymentAccepted=array('MO/Check','Visa','MasterCard','Paypal'); // these values should be the same as on google base xml feed spec

$locationAddress='PO Box 30169';

 

//GOOGLE SPECIFIC Settings

$destination_file = "mysite.xml"; //the upload file name specified on google base

$ftp_server = "uploads.google.com" ; //google ftp server

$ftp_user_name = "mysite"; //ftp user name

$ftp_user_pass = "xxxxxxxx"; //ftp password

$ftp_directory = ""; // leave blank

 

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

// This query is required if you want to use categories names as search and grouping tags in EDGEIO.COM serach engine

//select categories, the categories names will be used as tags and keywords for listings

$result=tep_db_query("SELECT * FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id");

$categories=array();

while($row = tep_db_fetch_array($result)){

$categories[$row['categories_id']]['name']=htmlspecialchars($row['categories_name']);

$categories[$row['categories_id']]['parent']=$row['parent_id'];

}

 

$categorytag=array();

//now find path from this category to its parent and then to root so their names can be used as tags

foreach($categories as $key=>$value){

$end=0;

$tags=array($value['name']);

$nextid=$value['parent'];

do{

if($nextid!=0){

array_push($tags,$categories[$nextid]['name']);

$nextid=$categories[$nextid]['parent'];

}else{

$end=1;

}

}while($end!=1);

 

$categorytag[$key]=$tags;

}

 

 

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

//Retrieve all product/products_description information feel free to change this

$result=tep_db_query("select * from products p, products_description pd, products_to_categories ptc where p.products_id=pd.products_id and p.products_id=ptc.products_id and p.products_quantity>0 and p.products_status=1 " . $limit);

 

 

if($edgeio){

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

BUILD EDGEIO FILE

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

$output='<?xml version="1.0" encoding="ISO-8859-1" ?>'."\n";

$output.='<rss version="2.0" xmlns:edgeio="http://www.edgeio/com/api/v1">'."\n";

$output.='<channel>'."\n";

$output.='<title>'.$feedTitle.'</title>'."\n";

$output.='<link>'.$siteUrl.'</link>'."\n";

$output.='<feed>'.$feedUrl.$fileEdgeio.'</feed>'."\n";

$output.='<language>'.$language.'</language>'."\n";

$output.='<pubDate>'.date("r").'</pubDate>'."\n";

$output.='<lastBuildDate>'.date("r").'</lastBuildDate>'."\n";

$output.='<docs>http://blogs.law.harvard.edu/tech/rss</docs>'."\n";

$output.='<generator>Edgeio publishing script for oSCommerce 1.1</generator>'."\n";

 

 

while($row = tep_db_fetch_array($result)){

 

$output.=' <item>'."\n";

$output.=' <guid>'.xmlentities($siteUrl.$row['products_id']).'</guid>'."\n";

$output.=' <pubDate>'.date("r").'</pubDate>'."\n";

$output.=' <title>'.xmlentities(strip_tags($row['products_name']). " - " . $row['products_model']) .'</title>'."\n";

$output.=' <link>'.$productUrl . $row['products_id'] .'</link>'."\n";

$output.=' <description>'.xmlentities(strip_tags($row['products_description']))."\n";

$output.=' <![CDATA['."\n";

$output.= <img src="'.urlencode($imageUrl . $row['products_image]) . '" />'."\n" ;

$output.=' <span class="price">'.$currency.' '.number_format($row['products_price'], 2, '.', '').'</span>'."\n";

$output.=' <abbr class="dtexpired" title="'.get_iso_8601_date(time() + ($ttl * 24 * 60 * 60)).'">'.date("F j, Y",strtotime("+".$Ttl." day")).'</abbr>'."\n";

$output.=' ]]>'."\n";

$output.=' </description>'."\n";

$output.=' <category>listing</category>'."\n";

$output.=' <category>for+sale</category>'."\n";

$output.=' <category>city:'.urlencode($locationCity).'</category>'."\n";

$output.=' <category>state:'.urlencode($locationState).'</category>'."\n";

$output.=' <category>zip:'.urlencode($locationZip).'</category>'."\n";

$output.=' <category>country:'.urlencode($locationCountry).'</category>'."\n";

if(isset($categorytag[$row['categories_id']])){

foreach($categorytag[$row['categories_id']] as $key=>$value){

$output.=' <category>'.urlencode($value).'</category>'."\n";

}

}

$output.=' </item>'."\n";

}

 

$output.='</channel>'."\n";

$output.='</rss>'."\n";

 

if ( file_exists( $feedDirectory.$fileEdgeio ) )

unlink($feedDirectory.$fileEdgeio );

 

$fp = fopen($feedDirectory.$fileEdgeio , "w" );

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

fclose( $fp );

if(!$dryrun){

echo sendPing($feedTitle,$siteUrl,$feedUrl.$fileEdgeio);

}

echo '<p><a href="'.$feedUrl.$fileEdgeio.'">Edgeio File</a><p>';

}

 

mysql_data_seek($result, 0);//rewind the dataset

 

if($googlebase){

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

BUILD GOOGLE FILE

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

 

$output='<?xml version="1.0" encoding="UTF-8" ?>'."\n";

$output.='<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'."\n";

$output.='<channel>'."\n";

$output.='<title>'.$feedTitle.'</title>'."\n";

$output.='<description>'.$feedDescription.'</description>'."\n";

$output.='<link>'.$siteUrl.'</link>'."\n";

 

 

while($row = tep_db_fetch_array($result)){

 

$output.=' <item>'."\n";

$output.=' <title>'.xmlentities(strip_tags($row['products_name']). " - " . $row['products_model']) .'</title>'."\n";

$output.=' <description>'.xmlentities(strip_tags($row['products_description']))."</description>\n";

$output.=' <link>'.$productUrl . $row['products_id'] .'</link>'."\n";

$output.=' <g:image_link>'.urlencode($imageUrl . $row['products_image']) .'</g:image_link>'."\n";

$output.=' <guid isPermaLink="false">'.xmlentities($siteUrl.$row['products_id']).'</guid>'."\n";

$output.=' <g:expiration_date>'.get_iso_8601_date(time() + ($ttl * 24 * 60 * 60)).'</g:expiration_date>'."\n";

$output.=' <g:currency>'.$currency.'</g:currency>'."\n";

$output.=' <g:price>'.number_format($row['products_price'], 2, '.', '').'</g:price>'."\n";

$output.=' <g:upc>'.$row['products_model'].'</g:upc>'."\n";

//$output.=' <g:quantity>'.$row['products_quantity'].'</g:quantity>'."\n";

foreach($paymentAccepted as $key=>$value){

$output.=' <g:payment_accepted>'.$value.'</g:payment_accepted>'."\n";

}

$output.=' <g:location>'.xmlentities($locationAddress.','.$locationCity.','.$locationState.','.$locationZip.','.$locationCountry).'</g:location>'."\n";

$output.=' </item>'."\n";

}

$output.='</channel>'."\n";

$output.='</rss>'."\n";

 

if ( file_exists( $feedDirectory.$fileGoogle ) )

unlink( $feedDirectory.$fileGoogle );

 

$fp = fopen( $feedDirectory.$fileGoogle , "w" );

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

fclose( $fp );

if(!$dryrun){

$result=ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $feedDirectory.$fileGoogle, $ftp_directory, $destination_file);

}

echo '<a href="'.$feedUrl.$fileGoogle.'">Google File</a>';

}

 

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

***********THE END FOLKS**********

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

 

 

//--EDGEIO.COM --CLASS CODE DO NOT CHANGE CODE BELOW THIS LINE--//

 

 

function sendPing($name="", $url="", $rss="") {

$fp = fsockopen("www.edgeio.com", 80, &$errnum, &$errstr);

 

if(!$fp) {

return "$errstr ($errnum)<br>\n";

}

 

if ($rss != "") {

$method = "weblogUpdates.extendedPing";

} else {

$method = "weblogUpdates.ping";

}

 

$xml = "<?xml version=\"1.0\"?><methodCall><methodName>" .$method .

"</methodName><params><param><value>$name</value></param><param><value>".htmlspecialchars(canonical_url($url))."</value></param>";

if ($rss != "") $xml .= "<param><value>foo</value></param><param><value>".htmlspecialchars(canonical_url($rss))."</value></param>";

$xml .= "</params></methodCall>";

 

$len = strlen($xml);

fputs($fp,"POST /RPC2 HTTP/1.0\r\n");

fputs($fp,"Content-Type: text/xml\r\n");

fputs($fp,"Content-length: $len\n\n");

fputs($fp,$xml);

 

$output="";

while(!feof($fp)) $output.=fgets($fp,4096);

fclose($fp);

 

return $output;

}

 

function canonical_url($url)

{

$url = trim($url);

if (substr($url,0,7)!="http://") $url = "http://".$url;

$u = @parse_url($url);

if (!$u) return "";

if (!$u['path'] && !$u['query'] && !$u['fragment']) $url .= "/";

return $url;

}

 

//Start FTP to Google Base

 

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;

}

 

function get_iso_8601_date($int_date) {

//$int_date: current date in UNIX timestamp

$date_mod = date('Y-m-d\TH:i:s', $int_date);

$pre_timezone = date('O', $int_date);

$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);

$date_mod .= $time_zone;

return $date_mod;

}

 

function xmlentities($string) {

return str_replace ( array ( '&', '"', "'", '<', '>', '?' ), array ( '&' , '"', ''' , '<' , '>', ''' ), $string );

}

 

 

?>

Edited by running wolf

Kristine Running Wolf

Link to comment
Share on other sites

no idea, here is my modified file, runs just great

 

So you use this for google only but not edgeio. And I only need this for edgeio and want it ping the server directly. Also, that "limit" thing you can simply comment it out rather than change the number since it's for debugging only.

Link to comment
Share on other sites

My problem is that the module isn't generating correct image URLs for either Edgeio or Google Base. Product URLs are fine, starting "http://" etc etc, but image URLs come out "http%3A%2F%2F" etc etc. As a result my listings in Edgeio don't have ay images, which hits my sales tremendously.

 

I've tried to contact Edgeio but not got a reply. I noticed that just after I e-mailed them a new version was uploaded to the OsC contributions page, but this was a PREVIOUS version, V1.2 (June 16th) where as the on before that was V1.4. Confused???? Maybe it should have been V1.5?

 

Does anyone else have any trouble with rss_edgeio.php getting the image URLs wrong? Is it a setting in the module or something on my server?

 

All thoughs greatly appreciated.

 

Mike

Link to comment
Share on other sites

If some one could come up with a fix for listing the specials price instead of the regular price when the specials price is available for a product , that would be fantastic !

 

Thanks

I'm not a coder just a splicer.

Link to comment
Share on other sites

If some one could come up with a fix for listing the specials price instead of the regular price when the specials price is available for a product , that would be fantastic !

 

Thanks

 

I have just noticed this, i have had this problem with EP in the past, any ideas?

Link to comment
Share on other sites

I have just noticed this, i have had this problem with EP in the past, any ideas?

 

I had lost a lot of 1st positioning in Froogle on many items due to the fact this contrib picked up the regular price and not the specials price. I think this is the only modification it needs to finish it.

 

Jimmy

www.DVBHardware.com

I'm not a coder just a splicer.

Link to comment
Share on other sites

This should help with the specials pricing problem, if somebody could check it through,

 

If you find (around line 158):

 

while($row = tep_db_fetch_array($result)){

 

and add this:

 

$sql2 = "SELECT

specials_new_products_price

FROM specials

WHERE

products_id = " . $row['products_id'] . " and

status = 1

ORDER BY

specials_id DESC"

;

$result2 = tep_db_query($sql2);

$ll = 1;

$row2 = tep_db_fetch_array($result2);

if( $row2 ){

 

 

$row['products_price'] = $row2['specials_new_products_price'];

}

Link to comment
Share on other sites

Hi Future1,

Could you please be more specific to let us know where to put this code.

 

My source code shows this "while($row = tep_db_fetch_array($result)){" in 3 places on line 59, line 105, and 163.

 

Also when you say "and add this:" did you mean immediately after the line, under the line of code, or in place of the code?

 

Thanks for the additional clarification.

 

 

 

This should help with the specials pricing problem, if somebody could check it through,

 

If you find (around line 158):

 

while($row = tep_db_fetch_array($result)){

 

and add this:

 

$sql2 = "SELECT

specials_new_products_price

FROM specials

WHERE

products_id = " . $row['products_id'] . " and

status = 1

ORDER BY

specials_id DESC"

;

$result2 = tep_db_query($sql2);

$ll = 1;

$row2 = tep_db_fetch_array($result2);

if( $row2 ){

$row['products_price'] = $row2['specials_new_products_price'];

}

Link to comment
Share on other sites

My problem is that the module isn't generating correct image URLs for either Edgeio or Google Base. Product URLs are fine, starting "http://" etc etc, but image URLs come out "http%3A%2F%2F" etc etc. As a result my listings in Edgeio don't have ay images, which hits my sales tremendously.

 

I've tried to contact Edgeio but not got a reply. I noticed that just after I e-mailed them a new version was uploaded to the OsC contributions page, but this was a PREVIOUS version, V1.2 (June 16th) where as the on before that was V1.4. Confused???? Maybe it should have been V1.5?

 

Does anyone else have any trouble with rss_edgeio.php getting the image URLs wrong? Is it a setting in the module or something on my server?

 

All thoughs greatly appreciated.

 

Mike

I am having the same issue. I have everything else worked out but the image URLs are hosed so I have not uploaded the feed it generates knowing I would have no images. I found the line causing the problem in rss_edgeio.php and it is this line:

 

$output.=' <g:image_link>'.urlencode($imageUrl . $row['products_image']) .'</g:image_link>'."\n";

 

The urlencode part there is what is doing that and simply removing that does not solve the problem. Yes the URLs for images then look normal but the script errors out before finsihing the generation of the entire feed if I set the limit above 10 items. I don't really understand what is going on but would love to see the image URL issue resolved.

 

Has anyone resolved this and how?

 

Thanks.

Edited by docprego
Link to comment
Share on other sites

Thanks future1 that seem to do the trick.

Version 1.5 fixes the image url.

 

I solved my problem. It seems that if the image link included a ampersand then I got an error about the image URL being formed poorly. Since I only had 2 products with that situation I renamed them without ampersands and now everything is great.

 

Another question:

 

Which fields MUST I include in the feed to be listed on Froogle?

 

Thank you.

Link to comment
Share on other sites

I solved my problem. It seems that if the image link included a ampersand then I got an error about the image URL being formed poorly. Since I only had 2 products with that situation I renamed them without ampersands and now everything is great.

 

Another question:

 

Which fields MUST I include in the feed to be listed on Froogle?

 

Thank you.

 

 

 

Hey guys I am using the same version 1.5 but the image errors are still comming

 

<g:image_link>http%3A%2F%2Fwww.khunbetta.com%2Fimages%2FS4010087.jpg</g:image_link>

 

What to please help as i am not too good in php

Link to comment
Share on other sites

Hey guys I am using the same version 1.5 but the image errors are still comming

 

<g:image_link>http%3A%2F%2Fwww.khunbetta.com%2Fimages%2FS4010087.jpg</g:image_link>

 

What to please help as i am not too good in php

 

 

I am also having problems with my link url. example.

 

http://www.mysite.com/product_info?product_id=222

 

but it should show like this

 

http://www.mysite.com/product_info/product_id/222

 

which means i should set true to safe urls in admin, but when i do that links on website stop working and every page it says no product found.

 

can some one please help. I am stuck here.

Link to comment
Share on other sites

I am also having problems with my link url. example.

 

http://www.mysite.com/product_info?product_id=222

 

but it should show like this

 

http://www.mysite.com/product_info/product_id/222

 

which means i should set true to safe urls in admin, but when i do that links on website stop working and every page it says no product found.

 

can some one please help. I am stuck here.

 

I got a repl form Edgeio, the problm with the "http%3A%2F%2F" thing is URL encode. V1.5 wa supposed to fix this & all runs fine on my server now this is uploaded.

 

I can only suggest you make ure that the image link line in rss_edgeio.php looks like this:

 

<img src="'.$imageUrl . $row['products_image'] . '" />'."\n" ;

 

Any reference of "urlencode" should be removed.

Link to comment
Share on other sites

I am having the same problem with the images link on google base. I am using 1.5 and the images are not showing up on google base because of the "http%3A%2F%2F" problem. The link however shows up fine in the xml output. Please advise.

Link to comment
Share on other sites

Google base rejected my data feed due to " Invalid location value".

 

This is strange cause at first, Google doesn't tell me it is wrong. I have successfully post my data feed and processed by Google without any problem before. But today, I found all my feeds have "Errors" in location value. Here is what Google's page says:

 

Invalid location value - help 1818-30 Charles Street West,Toronto,ON,M4Y 1R5,Canada

....

 

on their help page, they say:

Invalid location value

The value you entered is not a valid location. Please be sure to include a street, city, state, postal code, and country, in that order. Each location element should be separated by a comma. For example, "123 Main Street, Anytown, CA-55555" is a valid location, but "San Francisco Airport" is not.

 

It seems that in the help, it only say that the order of the location information is important. But I think "1818-30 Charles Street West,Toronto,ON,M4Y 1R5,Canada" is at the right order ( street, city, state, postal code, country ). So, I don't know where is wrong, especially considered that it is "right" before in Google's eyes.

 

Here is what in the rss_edgeio.php file:

 

....

$locationCity='Toronto'; //location of the product

$locationState='ON';

$locationZip='M4Y 1R5';

$locationCountry='Canada';

...

$locationAddress='1818-30 Charles Street West';

...

 

 

Can anyone help me out?

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...