Jump to content

Google Base Update


Guest ITechWest

Recommended Posts

Guest ITechWest

Google Base has added a product ID requirement for the upload, this needs to be fixed in export.inc.php, can you guys take a look.

I am using 4.1.1

Current Code

if ($results == true) {

$googleBaseContent = "product_url\tname\tdescription\timage_url\tprice\tcurrency\r\n";

for ($i=0; $i<count($results); $i++) {

$salePrice = salePrice($results[$i]['price'], $results[$i]['sale_price']);

$price = ($salePrice > 0) ? $salePrice : $price = $results[$i]['price'];

$name = str_replace(array("&nbsp;","\t","\r","\n","\0","\x0B","

"),"",strip_tags($results[$i]['name']));

$name = str_replace(" ","",$name);

$desc = str_replace(array("&nbsp;","\t","\r","\n","\0","\x0B","

"),"",strip_tags($results[$i]['description']));

$desc = str_replace(" ","",$desc);

if ($config['sef'] == 0) {

$googleBaseContent .= $glob['storeURL']."/index.php?_a=viewProd&productId=".$results[$i]['productId']."\t".$name."\t".$desc;

} else {

include_once("includes".CC_DS."sef_urls.inc.php");

$googleBaseContent .= $glob['storeURL']. "/" .generateProductUrl($results[$i]['productId'])."\t".$name."\t".$desc;

}

if ($results[$i]['image']) {

$googleBaseContent .= "\t".$glob['storeURL']."/images/uploads/".$results[$i]['image'];

} else {

$googleBaseContent .= "\t".$glob['storeURL']."/skins/".$config['skinDir']."/styleImages/nophoto.gif";

}

$googleBaseContent .= "\t".$price."\t".$config['defaultCurrency']."\r\n";

Link to comment
Share on other sites

Hi All

Simple change:

if ($results == true) {

$googleBaseContent = "id\tproduct_url\tname\tdescription\timage_url\tprice\tcurrency\r\n";

//ADDED THIS//////////^^^^



for ($i=0; $i<count($results); $i++) {



//ADDED THE BELOW LINE

$googleBaseContent .= $results[$i]['productId']."\t";



$salePrice = salePrice($results[$i]['price'], $results[$i]['sale_price']);

$price = ($salePrice > 0) ? $salePrice : $price = $results[$i]['price'];



$name = str_replace(array("&nbsp;","\t","\r","\n","\0","\x0B","

"),"",strip_tags($results[$i]['name']));

$name = str_replace(" ","",$name);

$desc = str_replace(array("&nbsp;","\t","\r","\n","\0","\x0B","

"),"",strip_tags($results[$i]['description']));

$desc = str_replace(" ","",$desc);



if ($config['sef'] == 0) {

$googleBaseContent .= $glob['storeURL']."/index.php?_a=viewProd&productId=".$results[$i]['productId']."\t".$name."\t".$desc;

} else {

include_once("includes".CC_DS."sef_urls.inc.php");

$googleBaseContent .= $glob['storeURL']. "/" .generateProductUrl($results[$i]['productId'])."\t".$name."\t".$desc;

}



if ($results[$i]['image']) {

$googleBaseContent .= "\t".$glob['storeURL']."/images/uploads/".$results[$i]['image'];

} else {

$googleBaseContent .= "\t".$glob['storeURL']."/skins/".$config['skinDir']."/styleImages/nophoto.gif";

}



$googleBaseContent .= "\t".$price."\t".$config['defaultCurrency']."\r\n";

What I have done here is use the product ID field in the database as this is a unique field and will never be used again if a product is deleted.

Adam

Link to comment
Share on other sites

Also GoogleBase didn't like the fact that some descriptions were blank.

I think I've managed to get around this by adding:

." Click for more info."

to the end of line 55 (or 57 if you are using SEF links):

$googleBaseContent .= $glob['storeURL']."/index.php?_a=viewProd&productId=".$results[$i]['productId']."\t".$name."\t".$desc." Click for more info.";

Link to comment
Share on other sites

Guest xceejayx

What I have done here is use the product ID field in the database as this is a unique field and will never be used again if a product is deleted.

Adam

I tried this fix.

I get the following errors from google once they have processed the file.

EDIT - Nevermind - disco_ii_disco's post fixed the errors. :)

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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