Jump to content
gottaloveit

Automatically send data feed to Froogle

Recommended Posts

I am receiving an error undefined variable: quantity on line 301. Here is the link googledatafeed.txt.

<?php
/*
Title: Google Base Auto Feeder 1.2
This feeder has been revised to work with Ultimate SEO URLs 2.1d (http://www.oscommerce.com/community/contributions,2823)
*/

// ########## BEGIN CONFIGURATION ###################

// START Main Configuration
// CHANGEME - Change to 'false' to disable the use of SEO
 define('SEO_ENABLED','false');

// CHANGEME - Change this to the id of your language.  BY default 1 is english
 $languages_id = 1;   

// CHANGEME - Change this to Pounds or so
 $WeightUnit = " LBS";	
//End Main Configuration

// START Optional Advance Configuration
// Monetary Adjustments for Products in Feed
// default = 0 (e.g. for 17.5% tax use "$taxRate = 17.5;")
$taxRate = 0; 

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

// default = true
$convertCur = true; 

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

// START Optional Advance Feed Attributes
// (0=False 1=True) (optional_sec must be enabled to use any of the following options)
$optional_sec = 1;

$manufacturer = 1;

$mpn = 1;   //model no. in osC is used here

$payment_accepted = 1;
// CHANGEME - Acceptable values: cash, check, GoogleCheckout, Visa, MasterCard, AMEX, Discover, wiretransfer
$default_payment_methods = "Visa,MasterCard,AmericanExpress,check"; 

$product_type = 1;

$currency = 1;
// CHANGEME - Change this to Google Base Currency - USD or so
$default_currency = "USD";  //this is not binary.

$model_number = 1;

$feed_quantity = 1;

$brand = 1; // 31 jan 2007 Added condition due to Google Base making mandatory

$condition = 1; // 31 jan 2007 Added condition due to Google Base making mandatory
// CHANGEME - Change this to Old or so
	$default_condition = "New"; // 31 jan 2007 Added condition due to Google Base making mandatory

$age_range = 1; // 31 jan 2007 Added condition due to Google Base making mandatory
// CHANGEME - Change this to Age Range who could bioew your feeds - 30-60 or so
	$default_age_range = "20-90"; // 31 jan 2007 Added condition due to Google Base making mandatory

$made_in = 1; // 31 jan 2007 Added condition due to Google Base making mandatory
// CHANGEME - Change this to your country - USA or so
	$default_made_in = "USA"; // 31 jan 2007 Added condition due to Google Base making mandatory

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

$upc = 0;   //Not supported by default osC

$location = 0;
// CHANGEME - Change this to your place if enabled
$default_location = "";

$feed_language = 0;
// CHANGEME - Change this to Google Base Feed Language - FR or so if enabled
$default_feed_language = "EN";  //this is not binary.

$feed_manufacturer_id = 0; //this is for the manufacturer model number, NOT your internal store sku
// END Optional Advance Feed Attributes

// ########## END CONFIGURATION ###################
//Please avoid editing the codes below

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

 require_once('includes/configure.php');
 require_once('includes/filenames.php');
 require_once('includes/database_tables.php');

 $home = DB_SERVER;
 $user=DB_SERVER_USERNAME;
 $pass=DB_SERVER_PASSWORD;
 $base=DB_DATABASE;
 $catalogURL = HTTP_SERVER.'/';
 $imageURL = HTTP_SERVER.'/'.DIR_WS_IMAGES;

if(SEO_ENABLED=='true'){
 include_once('includes/classes/seo.class.php');
 $seo_urls = new SEO_URL($languages_id);

 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
 global $seo_urls;
 return $seo_urls->href_link($page, $parameters, $connection, $add_session_id);
 }
}

if(SEO_ENABLED=='true'){
  $productURL = 'product_info.php'; 
  $productParam = "products_id=";   
}else{
  $productURL = HTTP_SERVER.'/product_info.php/products_id/';
}

$already_sent = array();

if($convertCur)
{
  if(SEO_ENABLED=='true'){
   $productParam="" . $curType . "&products_id=";
  }else{
   $productURL = HTTP_SERVER."/product_info.php?currency=" . $curType . "&products_id=";  //where CURTYPE is your currency type (eg. USD, EUR, GBP)
  }
}


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 AS 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" => "", "	" => "");

$output = "link\ttitle\tdescription\texpiration_date\tprice\timage_link\tgenre\tid\tweight";
//create optional section
if($optional_sec == 1)
{
if($shipping == 1)
	$output .= "\tshipping";
if($manufacturer == 1)
	$output .= "\tmanufacturer";
   if($model_number==1)
			$output .= "\tmodel_number";
if($upc == 1)
	$output .= "\tupc";
if($mpn == 1)
	$output .= "\tmpn";
if($payment_accepted == 1)
	$output .= "\tpayment_accepted";
if($product_type == 1)
	$output .= "\tproduct_type";
if($currency == 1)
	$output .= "\tcurrency";
	if($location == 1)
			$output .= "\tlocation";
if($feed_language == 1)
	$output .= "\tlanguage";
if($feed_manufacturer_id == 1)
	$output .= "\tmanufacturer_id";
if($feed_quantity == 1)
	$output .= "\tquantity";
if($brand == 1)  // 31 jan 2007 Added condition due to Google Base making mandatory
	$output .= "\tbrand"; // 31 jan 2007 Added condition due to Google Base making mandatory
if($condition == 1) // 31 jan 2007 Added condition due to Google Base making mandatory
	$output .= "\tcondition"; // 31 jan 2007 Added condition due to Google Base making mandatory
if($age_range == 1)  // 31 jan 2007 Added condition due to Google Base making mandatory
	$output .= "\tage_range"; // 31 jan 2007 Added condition due to Google Base making mandatory
if($made_in == 1) // 31 jan 2007 Added condition due to Google Base making mandatory
	$output .= "\tmade_in"; // 31 jan 2007 Added condition due to Google Base making mandatory
}
$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 );
}

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 && $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, '.', ',');
	}

	if(SEO_ENABLED=='true'){
			$output .= tep_href_link($productURL,$productParam . $row->id) . "\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 . "\t" .
	$row->weight . $WeightUnit;
	}else{
	$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" .
	$feed_exp_date . "\t" .
	$row->price . "\t" .
	$row->image_url . "\t" .
	$catIndex[$row->prodCatID] . "\t" .
	$row->id . "\t" .
	$row->weight . $WeightUnit;
	}

//optional values section
if($optional_sec == 1)
{
	if($shipping == 1)
		$output .= "\t" . $lowestShipping;
	if($manufacturer == 1)
		$output .= "\t" . $row->mfgName;
			if($model_number==1)
		$output .= "\t" . $row->prodModel;
	if($upc == 1)
		$output .= "\t" . $row->prodModel;
	if($mpn == 1)
		$output .= "\t" . $row->prodModel;
	if($payment_accepted == 1)
		$output .= "\t" . $default_payment_methods;
	if($product_type == 1)
	{
		$catNameTemp = strtolower($catName);
		$output .= "\t" . $row->catName;
	}
	if($currency == 1)
		$output .= "\t" . $default_currency;
			if($location==1)
					$output .= "\t" . $default_location;
	if($feed_language == 1)
		$output .= "\t" . $default_feed_language;
	if($feed_manufacturer_id == 1)
		$output .= "\t" . $row->prodModel;
	if($feed_quantity == 1)
		$output .= "\t" . $row->quantity;
	if($brand==1)
					$output .= "\t" . $row->mfgName;
	if($condition == 1)	 // 31 jan 2007 Added condition due to Google Base making mandatory
		$output .= "\t" . $default_condition; // 31 jan 2007 Added condition due to Google Base making mandatory
	if($age_range == 1)	// 31 jan 2007 Added condition due to Google Base making mandatory
		$output .= "\t" . $default_age_range; // 31 jan 2007 Added condition due to Google Base making mandatory
	if($made_in == 1)	 // 31 jan 2007 Added condition due to Google Base making mandatory
		$output .= "\t" . $default_made_in; // 31 jan 2007 Added condition due to Google Base making mandatory
}
$output .= "\n";
}
$already_sent[$row->id] = 1;
}
echo $output;
?>

If I remove the quantity variable on line 301 I no longer get an error, is the quantity variable necessary for google base or not?


I am currently just learning osCommerce and PHP, but am always willing to help out.

 

Have successfully installed the following: Discount Coupons, UPS shipping module, Ultimate SEO URL's, Easy Meta Tags for SEO 1.0, Google XML Sitemap SEO v1.3, HTML Editor for Email and Newsletters.

Share this post


Link to post
Share on other sites

$quantity doesn't seem to be defined anywhere, so it should be safe to remove that part of the if() statement.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites
$quantity doesn't seem to be defined anywhere, so it should be safe to remove that part of the if() statement.

 

Regards

Jim

Thank you. It seems to be working right now, google base is processing right now. Again, thank you for responding.

 

Regards,

 

Neal


I am currently just learning osCommerce and PHP, but am always willing to help out.

 

Have successfully installed the following: Discount Coupons, UPS shipping module, Ultimate SEO URL's, Easy Meta Tags for SEO 1.0, Google XML Sitemap SEO v1.3, HTML Editor for Email and Newsletters.

Share this post


Link to post
Share on other sites

I have searched through this as well as I can and haven't been able to find a solution for my problem.

 

Google base fails and gives me this error:

 

"We didn't understand the header (first) row of your file. Please make sure you're using valid attribute names."

 

If I go to either of these files, it also has errors:

http://www.2lilangelsboutique.com/product_feed.txt

http://www.2lilangelsboutique.com/googlebase.php

 

I followed the instructions to a T so if anyone can help, it would be greatly appreciated!

 

Thanks! :)

 

Edited to add, I just noticed I'm using SEO-G and not Ultimate SEO, will this contribution still work for me?

Edited by mom2twins

Share this post


Link to post
Share on other sites

It appears that this addon was written to work with Ultimate SEO and not the one you are using. You would need to make modifications fo make this one work with your SEO package.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Help!

 

I have live working shop using Ultimate SEO URLS v2.6 with GoogleXML Sitemap v1.1 - all fine no issues. I urgently need to upload to Google Base and have installed Google Base v1.25 (30 Dec 08) which results in these two responses via browser:

 

/googlefeeder.php

 

HEADING_TITLE

File completed: xxxxxxxxPART01.txt

Connected to uploads.google.com, for user xxxxxxxxx

Uploaded http://www.domain/feeds/xxxxxxxxPART01.txt to uploads.google.com as xxxxxxxxxPART01.txt

 

Script timer: 19.909242 seconds.

 

/feeds/xxxxxxxxxPART01.txt

 

{\rtf1\ansi\ansicpg1252\cocoartf949

{\fonttbl}

{\colortbl;\red255\green255\blue255;}

\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0

}

 

Should I be using latest Google Base Auto Feeder v1.1 (12 Feb 09) and if so is contribution only two files?

Share this post


Link to post
Share on other sites

1. You can use whichever addon you wish.

 

2. What's in the distribution is what's in the distribution.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites
1. You can use whichever addon you wish.

 

2. What's in the distribution is what's in the distribution.

 

Regards

Jim

 

 

Thanks for that Jim. I have used the Auto Base Feeder add-on and it's up and running on Google Shopping but with one issue. The googlebase.php generates all as per set up but in the case of the images directory which is in the Catalogue Directory on the server it ignores the "catalogue" part of the URL for the image link, ie "http://www.domain.co.uk/images/" instead of "http://www.domain.co.uk/catalogue/images/"

 

The URL for the product within the catalogue directory is, of course, fine otherwise it wouldn't have got to Google Shopping. Any ideas why this blip is happening? Many thanks.

 

Michael

Share this post


Link to post
Share on other sites

Hi All,

 

Just a quick question: Has anyone looked at getting this great contribution to work with FWR Media's Ultimate Seo URL's v5? I now have that contribution installed but am wondering what to do with regards to the Google feeder that relied on the now non-existant seo.class.php

 

Any help would be appreciated!

 

Kind regards,

James

Share this post


Link to post
Share on other sites
Hi All,

 

Just a quick question: Has anyone looked at getting this great contribution to work with FWR Media's Ultimate Seo URL's v5? I now have that contribution installed but am wondering what to do with regards to the Google feeder that relied on the now non-existant seo.class.php

 

Any help would be appreciated!

 

Kind regards,

James

 

Same problem here, upgraded to V5 SEO URL's and didn't appreciate that this contrib relied on seo.class.php.

 

What I can tell you is don't restore this file. it's not used by V5 but it will cause the V2.x database entries to be reinstalled breaking V5 completely.

Share this post


Link to post
Share on other sites

Hi i installed google base and everything thing was running fine now i'm getting a deliminator error, i have not changed my feed file? Please advise.

 

when i go further in google it tells me:

 

Errors:

Error Bad data Line #

The item is missing a required attribute. help description

41

 

and

 

We were unable to match the attributes in this dsv (delimiter separated values) data feed line to the corresponding attributes in the header (first) row. help

150

Share this post


Link to post
Share on other sites

I'm running this file without any problem but it fails to load any products into google base when i upload the text file.

 

it says:

Error: Unrecognised header: link title description expiration_date price image_link genre id weight

 

I look at the text file and it is not seperating the fields with a tab or anything so it see's it all as 1 big word. Does anyone know why it might not be doing this?

Share this post


Link to post
Share on other sites

A new version has been uploaded. The code has been rearranged to allow easier setup. It also has the condition option set, which is now a google requirement.

 

Jack

Share this post


Link to post
Share on other sites
A new version has been uploaded. The code has been rearranged to allow easier setup. It also has the condition option set, which is now a google requirement.

 

Jack, I just installed 1.2 the other day and works fine. I just noticed your new 2.0 and liked it integration in the Admin better for ease of creating a new feed file.

 

I am getting a couple of errors from google that I am trying to resolve.

 

Feed Level Messages

Warning: Unsupported attribute: category

Warning: Missing recommended attribute: weight

 

Item Errors - 121 items with errors

Missing required attribute: condition

Invalid date time format in attribute: expiration date

 

I did have condition set to 1 and defined as "new"

 

 

Jimmy


I'm not a coder just a splicer.

Share this post


Link to post
Share on other sites

You have to look at the actual feed in the feeds directory to see if the file is formatted correctly. If there isn't a condition column that is filled in, then you must have changed the settings since that is set by default.

 

Jack

Share this post


Link to post
Share on other sites
Anyone know how I set googlefeeder.php for a UK feed? At the moment froogle defaults to US with out finding a ISO code for the UK in the feed.

 

I could probably edit the txt file each time but Id be really great if I could get it set in googlefeeder.php so I can set the cron job and forget about it.

 

is that mean that this addon one ( google base auto feeder 1_2_1) will not work for uk google base, because I want to use it in the UK and I have changed the configiration php file that came with tis add on but when i cheack my google base account the add on has not uploaded my products to google base , any one in the UK could please help how the get this add on works for google base uk

Share this post


Link to post
Share on other sites
A new version has been uploaded. The code has been rearranged to allow easier setup. It also has the condition option set, which is now a google requirement.

 

Jack

 

Jack I want to instal the new version of google base auto feeder you talked about - do i have to instal the Ultimate SEO in order for your addon to work ?? or is not neccessory. and will it work for the UK based

Share this post


Link to post
Share on other sites
Jack I want to instal the new version of google base auto feeder you talked about - do i have to instal the Ultimate SEO in order for your addon to work ?? or is not neccessory. and will it work for the UK based

No, Ultimate SEO is not required. Just be sure that setting is turned off in the file. There are also settings for the default language, currencies and the like so be sure to set those. It should work fine for the UK then.

 

Jack

Share this post


Link to post
Share on other sites

Jack,

 

I installed v1.2 two days ago and noticed you put up a new modification. I had difficulty installing it. Are their missing files? I'm lost. The readme is dated back to 2006.

 

 

Can you offer help in this regards?


plasma.jpg

Share this post


Link to post
Share on other sites

- Download the latest version

- Open it

- Edit the settings in the admin/googlefeeder.php file to work with your site

- Upload the admin/googlefeeder.php to your server - same location

- Run the script manually or wait for cron to do it

 

Jack

Share this post


Link to post
Share on other sites

Can anyone advise what I'm missing here?

 

I've managed to upload my feed (manually for now) to google base, but when you search for our products on google shopping our descriptions have quotes around them?

 

Do a google product search for office furniture and then narrow results down to our shop Simple Office Furniture to see what I mean.

 

Will be updating to the latest version of this contribution ASAP if this makes any difference?

 

Thanks

Lee

Share this post


Link to post
Share on other sites

Have installed the latest version now, so will see if that sorts out the quotes problem.

 

But I'm just wondering if anyone can give me a quick heads up on how to set this up to run as a CRON job? I know as much to access CRON jobs via my cpanel, but the command in the readme file looks like gobbeldegook - so if anyone could give me cut, copy and paste instructions, I would be very grateful.

Lee

Share this post


Link to post
Share on other sites

Hi. I've just tried to get Google Base Auto Feeder V1.2 to work on my site but having a problem.

 

This is the error I'm getting:

 

Fatal error: Call to undefined function: tep_not_null() in /home4/subcitiz/public_html/includes/classes/seo.class.php on line 960

 

 

Is this an easy fix or should I try another Google upload contribution such as Google Base / Froogle Data Feeder v1.00?

 

Thanks for any and all help!

 

Jason

Share this post


Link to post
Share on other sites
Have installed the latest version now, so will see if that sorts out the quotes problem.

 

But I'm just wondering if anyone can give me a quick heads up on how to set this up to run as a CRON job? I know as much to access CRON jobs via my cpanel, but the command in the readme file looks like gobbeldegook - so if anyone could give me cut, copy and paste instructions, I would be very grateful.

Lee

It can vary with the host so the most that can be given is in the instructions. You can try sending that to your host ans ask them to set it up. Some hosts will - some won't. There are also many sites on the web that explain how to setup a cron job.

 

Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×