Jump to content
gottaloveit

Automatically send data feed to Froogle

Recommended Posts

I tried hard to not ask this, but I can't find an answer anywhere. Is the very latest download on the Contributions page all I need for this add-on to work? I ask, because looking back at the many and varied updates to this very interesting add-on, there are other files and instructions dating a long way back, and with the latest version all there is is a simple read me file and the googlebase.php file.

 

Thanks - and sorry to ask.

 

Jonathan

Share this post


Link to post
Share on other sites
Hi Jim,

 

Apparantly I got a bit ahead of myself with the last post. Although my googlebase file is now viewable, Google is returning the message:

 

"Error Bad data Line #

We were unable to connect to the host holding your data feed."

 

Is this something that I can fix, or do I need to contact my host?

 

Cheers,

 

Dan

That appears to be an ambiguous error message. It means that Google's spider can't find the file. Make certain that you gave Google the correct address for the file you specified in your rewrite rule.It's best to view this file in your browser, then copy the address from your address bar and paste it into the Google feed box.

 

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
Are you doing a manual upload? If so, don't save the file from your browser window, that messes up the delimiters. Use View Source and save from there.

 

Regards

Jim

 

Thanks a lot! It worked well.

 

Hey I actually notices another problem, quite serious actually. Some products like for example helmets are being sold without VAT (tax) in UK. But the script doesn't seem to take the actual price of the item, seems like it adds TAX to all the products. So now half of my stuff is showing with higher price :(

Share this post


Link to post
Share on other sites
I tried hard to not ask this, but I can't find an answer anywhere. Is the very latest download on the Contributions page all I need for this add-on to work? I ask, because looking back at the many and varied updates to this very interesting add-on, there are other files and instructions dating a long way back, and with the latest version all there is is a simple read me file and the googlebase.php file.

 

Thanks - and sorry to ask.

 

Jonathan

 

I'm in the same boat Jonathan. What seems to make it even more confusing is that somewhere along the lines it appears some of the filenames have changed, amongst other things.

 

The version I am using shows this:

 

<?php

// Title: Google Base / Froogle Data Feeder 1.20

// Author: Calvin K

// Contact: calvink@conceptulanetworking.com

// Organization: Conceptual Networking

// Last Update: 2/20/07

 

I've been using this froogle feed now for a several years and just recently came to the realization that Google doesn't really even support the froogle feed anymore (I'm so out of touch!)

 

I also noticed that the aforementioned version does not deal well with MAP pricing - I am hoping a newer version handles that properly

 

Anyhow, any help here would be appreciated, and thanks in advance!!

Share this post


Link to post
Share on other sites

Hi , i installed the googlebase contrib, i have SEO installed from chemo, and i edited the googlebase.php to add seo = true

 

my problem is none of my images are showing!

 

i submited the googlefeed.txt file to google base, and this is the outcome:

 

 

Feed status details

Outcome: 		  Success
Number of items processed: 		  680
Number of inserted items: 		  680
Uploaded at: 		  Apr 2, 2009 7:00 pm PDT
Processed at: 		  Apr 2, 2009 7:16 pm PDT


Errors:
Error 	Bad data 	Line #
The item is missing a required attribute.   help 	

description

157
You must enter an item title. Title is a required attribute.   help 	

title

157
The item is missing a required attribute.   help 	

description

110
You must enter an item title. Title is a required attribute.   help 	

title

110
The item is missing a required attribute.   help 	

description

574
You must enter an item title. Title is a required attribute.   help 	

title

574
The item is missing a required attribute.   help 	

description

573
You must enter an item title. Title is a required attribute.   help 	

title

573
The item is missing a required attribute.   help 	

description

63
You must enter an item title. Title is a required attribute.   help 	

title

63
The item is missing a required attribute.   help 	

description

87
You must enter an item title. Title is a required attribute.   help 	

title

87
The item is missing a required attribute.   help 	

description

66
You must enter an item title. Title is a required attribute.   help 	

title

66
The item is missing a required attribute.   help 	

description

156
You must enter an item title. Title is a required attribute.   help 	

title

156
The item is missing a required attribute.   help 	

description

78
You must enter an item title. Title is a required attribute.   help 	

title

78
The item is missing a required attribute.   help 	

description

128
You must enter an item title. Title is a required attribute.   help 	

title

128
The item is missing a required attribute.   help 	

description

69
You must enter an item title. Title is a required attribute.   help 	

title

69
The item is missing a required attribute.   help 	

description

88
You must enter an item title. Title is a required attribute.   help 	

title

88
The item is missing a required attribute.   help 	

description

312
You must enter an item title. Title is a required attribute.   help 	

title

312
The item is missing a required attribute.   help 	

description

442
You must enter an item title. Title is a required attribute.   help 	

title

442
The item is missing a required attribute.   help 	

description

127
You must enter an item title. Title is a required attribute.   help 	

title

127
The item is missing a required attribute.   help 	

description

111
You must enter an item title. Title is a required attribute.   help 	

title

111
The item is missing a required attribute.   help 	

description

98
You must enter an item title. Title is a required attribute.   help 	

title

98
The item is missing a required attribute.   help 	

description

151
You must enter an item title. Title is a required attribute.   help 	

title

151
The item is missing a required attribute.   help 	

description

311
You must enter an item title. Title is a required attribute.   help 	

title

311
The item is missing a required attribute.   help 	

description

383
You must enter an item title. Title is a required attribute.   help 	

title

383
The item is missing a required attribute.   help 	

description

153
You must enter an item title. Title is a required attribute.   help 	

title

153
The item is missing a required attribute.   help 	

description

305
You must enter an item title. Title is a required attribute.   help 	

title

305
The item is missing a required attribute.   help 	

description

108
You must enter an item title. Title is a required attribute.   help 	

title

108
The item is missing a required attribute.   help 	

description

310
You must enter an item title. Title is a required attribute.   help 	

title

310
The item is missing a required attribute.   help 	

description

155
You must enter an item title. Title is a required attribute.   help 	

title

155
The item is missing a required attribute.   help 	

description

304
You must enter an item title. Title is a required attribute.   help 	

title

304
The item is missing a required attribute.   help 	

description

309
You must enter an item title. Title is a required attribute.   help 	

title

309
The item is missing a required attribute.   help 	

description

89
You must enter an item title. Title is a required attribute.   help 	

title

89
The item is missing a required attribute.   help 	

description

106
You must enter an item title. Title is a required attribute.   help 	

title

106
The item is missing a required attribute.   help 	

description

154
You must enter an item title. Title is a required attribute.   help 	

title

154
You must enter an item title. Title is a required attribute.   help 	

title

145
The item is missing a required attribute.   help 	

description

308
You must enter an item title. Title is a required attribute.   help 	

title

308
The item is missing a required attribute.   help 	

description

139
You must enter an item title. Title is a required attribute.   help 	

title

139
The item is missing a required attribute.   help 	

description

523
You must enter an item title. Title is a required attribute.   help 	

title

523

 

 

 

 

Why are my images not displaying at all? can someone please help!

 

here is my googlebase.php file:

 

 

 

<?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','true');

// 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 = " Gms.";	
//End Main Configuration

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

// 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 = "Paypal,Visa,MasterCard,AmericanExpress"; 

$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 = "12-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 = "USA";

$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;
?>

Edited by pure11

Share this post


Link to post
Share on other sites

Hi

 

Just installed Google Base Auto Feeder 1.2 on my site and in it's simplest form it works ok.

 

However, if I enable Optional Advance Feed Attributes within the contri to send other info with my feed, then my output file contains a whole load of;

 

Notice: Undefined variable: quantity in /home/karluadmin/public_html/googlebase.php on line 301

 

the products then show below all these (lots of em) error messages.

 

Any ideas anybody?

 

Thnx

Lou

Share this post


Link to post
Share on other sites

How soon should products show up in Froogle or Google Product Search once the upload is complete, processed, and says "published and searchable?"

 

I sent up my first feed, everything went well (or seems to have), but my product(s) do not come up in a search when I go to froogle or google product search. Does this take some time?

Share this post


Link to post
Share on other sites

Hello,

 

i have used this contib for sometime, but have recently added over 7767 products. Now all i get from the output file is:

 

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<HTML><HEAD>

<TITLE>500 Internal Server Error</TITLE>

</HEAD><BODY>

<H1>Internal Server Error</H1>

The server encountered an internal error or

misconfiguration and was unable to complete

your request.<P>

Please contact the server administrator,

webmaster@countybatteryservices.co.uk and inform them of the time the error occurred,

and anything you might have done that may have

caused the error.<P>

More information about this error may be available

in the server error log.<P>

</BODY></HTML>

 

Anybody else came across their sever crashing??

Share this post


Link to post
Share on other sites

Great contribution. Only issue I am having is that my store is in a sub folder www.mysite.com/catalog and the urls that are being submited to google are leaving out the sub folder www.mysite.com/product123 instead of www.mysite.com/catalog/product123 I did the standard installation and have the data feed setup correctly on google, everything works except the link

 

Thanks

CameronT21

Share this post


Link to post
Share on other sites

I downloaded Google Base Auto Feeder 1.2, which consists of a php file and instructions. I followed the instructions and uploaded the php file. Googlebase says that "Your data feed wasn't found at the specified location." When I go to the address for the text file, I get a 404 error.

 

Where should I start looking? And is the php file all there is to it?

 

Thanks for any help!

Share this post


Link to post
Share on other sites

Hi I am having problems with this contribute. Just not working for me.

Bad data Line #

Your data feed wasn't found at the specified location.

My googlebase.php file is located in a sub folder mysite.com/shop/6057/

is this OK?

Please Help I am not a coder. Thanks

Share this post


Link to post
Share on other sites
Hi I am having problems with this contribute. Just not working for me.

Bad data Line #

Your data feed wasn't found at the specified location.

My googlebase.php file is located in a sub folder mysite.com/shop/6057/

is this OK?

 

#<IfModule mod_php4.c>

# php_value session.use_trans_sid 0

# php_value register_globals 1

#</IfModule>

RewriteBase /:

#############################

# Begin Google Base File Rewrite Code

RewriteRule ppsdata_feed.txt googlebase.php

# End Google Base File Rewrite Code

#############################

Please Help I am not a coder. Thanks

Share this post


Link to post
Share on other sites
Hi I am having problems with this contribute. Just not working for me.

Bad data Line #

Your data feed wasn't found at the specified location.

My googlebase.php file is located in a sub folder mysite.com/shop/6057/

is this OK?

Please Help I am not a coder. Thanks

Do this first.

 

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
Can someone update the contribution to reflect this change?

You certainly can.

 

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
You certainly can.

 

Regards

Jim

Hi Jim,

Thanks so much for your help. The auto feed is giving an error.

 

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

{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf480

 

I am using a MAC.

Also there are no images attached in preview and can you eliminate tax from price?

Thanks

Share this post


Link to post
Share on other sites

It appears that your feed has some unusual characters in the first row. Post the first four rows of your feed in a code box and I'll take a look.

 

Tax etc. can be set in the top part of your googlebase.php.

 

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
Not sure if the contribution can support this, but here's how you can control tax/shipping for Google Product Search on a sku level.

 

http://www.loveyourfeed.com/how-to-submit-...ata-feed-92.htm

 

You can obviously control these settings on a global account level from within your Google Base account.

 

Thanks Ryan,

 

I'll take a look at that :)

 

Dave

Share this post


Link to post
Share on other sites

Hi I have been playing around with http://addons.oscommerce.com/info/4270 contribution and have created an admin section for this.

 

I have tried it out and it appears to work okay, I havent added it as a mod or update yet as I would like someone else to test it.

 

Its basically two files to upload into admin update the database with a few entrys, and add the links into the admin so it can be accessed easily.

 

Instructions:-

 

This contribution is based on the edgio google base contribution http://addons.oscommerce.com/info/4270

 

Just updated it to make it managable in admin.

 

If you replace the following in the sql data below before running the sql query then the files will be populated other than that you can edit these in configuration in myadmin.

 

xxx1xxx replace with user name for google ftp upload

xxx2xxx replace with password for google ftp upload needs to be 7 characters including numbers, letters and symbols ie. er?12x3

xxxCxxx replace with City your site is based

xxxCOxxx replace with County your site is based

xxxPxxx replace with Postcode your site is based

$$$ replace with 3 letter cuurency of site your site is based ie. GBP, EUR, USD

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

Important 254 is used here as the configuration_group_id, if this value is taken in your configuration_group table then replace 254 with the next available number, you will need to change the 254 entries to the new number in the remaining sql queries.

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

 

Copy and paste the amended sql data into your database

 

SQL DATA:-

 

INSERT INTO `configuration_group` (`configuration_group_id`, `configuration_group_title`, `configuration_group_description`, `sort_order`, `visible`) VALUES

(254, 'Google Base', 'Google Base Configuration', 300, 1

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES

( INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES

( NULL, 'Google Base FTP password', 'GOOGLE_BASE_FTPPASS', 'xxx1xxx', 'Your Google Base FTP password that you created when creating your acocunt at Google Base', 254, 8, '2009-05-30 15:30:34', '0000-00-00 00:00:00', NULL, '')

( NULL, 'Google Base FTP Username', 'GOOGLE_BASE_FTPUSER', 'xxx2xxx', 'Your Google Base FTP username that you created when creating your acocunt at Google Base', 254, 7, '2009-05-30 15:11:53', '0000-00-00 00:00:00', NULL, ''),

( NULL, 'Location City/Town', 'GOOGLE_BASE_CITY', 'xxxCxxx', 'Your Town or City', 254, 4, '2009-05-30 16:01:22', '0000-00-00 00:00:00', NULL, ''),

( NULL, 'Location County', 'GOOGLE_BASE_COUNTY', 'xxxCOxxx', 'Your County', 254, 5, '2009-05-30 16:01:35', '0000-00-00 00:00:00', NULL, ''),

( NULL, 'Location Postcode', 'GOOGLE_BASE_POSTCODE', 'xxxPxxx', 'Your Postcode', 254, 6, '2009-05-30 16:01:47', '0000-00-00 00:00:00', NULL, ''),

( NULL, 'Currency', 'GOOGLE_BASE_CURRENCY', '$$$', 'Which currency do you want to submit your feed in?', 254, 3, NULL, '0000-00-00 00:00:00', NULL, 'tep_cfg_select_option(array(''GBP'', ''EUR''),'),

( NULL, 'Limit Products count', 'GOOGLE_LIMIT_COUNT', '', 'Do you want to limit the number of products when submitting to Google, if so enter a number greater than 0 to specify the amount of products for each feed.', 254, 2, NULL, '0000-00-00 00:00:00', NULL, ''),

( NULL, 'Dry Run', 'GOOGLE_DRY_RUN', 'true', 'Do you want to run the Google Base functions without submitting to Google', 254, 1, '2009-05-30 16:38:51', '0000-00-00 00:00:00', NULL, 'tep_cfg_select_option(array(''true'', ''false''),'),

 

 

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

Upload the two admin files

 

googlebase.php and rss_edgeio.php to the admin folder

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

 

Create a feeds folder in catalog o you have catalog feeds set permissions to 777 on this folder.

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

admin/includes/boxes/tools.php

 

insert the following after '</a><br>' . and before a '<a href="'

 

'<a href="' . tep_href_link(FILENAME_GOOGLE_BASE) . '" class="menuBoxContentLink">' . BOX_TOOLS_GOOGLE_BASE. '</a><br>' .

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

admin/inlcudes/filenames.php

at end of file before ?> add

 

define('FILENAME_GOOGLE_BASE', 'google_base.php');

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

admin/includes/english.php

 

Find the BOX_TOOLS section and add at the end of it:-

 

define('BOX_TOOLS_GOOGLE_BASE', 'Google Base');

 

This should give you a configuration set for google base, and an admin link in the tools box, if set to dry run the file is created but not sent to google, and if dryrun is false then the feed is sent to google, you can cron job this I guess, however I always like to know if the file has been uploaded and the script should tell you if you have been successful or not

 

 

Johnny

code for the two files involved to follow

Edited by johnnybebad

Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

file code google_base.php upload to admin

 

<?php
 require_once('includes/application_top.php');


 $current_boxes = DIR_FS_ADMIN . DIR_WS_BOXES;
 $current_files = DIR_FS_ADMIN;

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
  <td width="100%" valign="top">
  <table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
  <td width="100%">
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
  <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2><?php echo tep_draw_separator('pixel_trans.gif', '10', '15'); ?></td>
</tr> 

   <tr>
  <td class="main" align="left" colspan=2><p>Welcome to Google Base submission, please ensure that you follow the instructions below before submitting your feeds to Google Base.</p>
<p><b><font color="#CC0000">N.B. You will only need to follow points 1,2 and 3 once. If you have already completed these you will not have to redo these.</font></b></p>
<ol>
<li>Create your google base account <a href="https://www.google.com/accounts/NewAccount?continue=http%3A%2F%2Fwww.google.com%2Fbase%2Fdashboard%3Fhl%3Den%26gl%3Dus&followup=http%3A%2F%2Fwww.google.com%2Fbase%2Fdashboard%3Fhl%3Den%26gl%3Dus&service=gbase&hl=en" target=_blank><b>click here</b></a></li>
<br><li>Create your Data feed as per the name below;</li> 
<br><ul type="disc">
<?

$fileGoogle="google_feed.xml";
echo "<li>".$fileGoogle."</li>"; 

?>
</ul>
<br><li>Enter your configuration settings <a href="configuration.php?gID=1007"><b>click here</b></a></li>
<br><li>Submit your files to Google Base <a href="google_base.php?submit=google"><b>click here</b></a></li>
</ol>

</td>
</tr> 
<?if ($_GET['submit']=='google'){?>
<tr>
<td colspan=2><?php include_once('rss_edgeio.php'); ?></td>
</tr>							   

<tr><td>

<?
}
?>
</table>
</td>
</tr>

  	</table>
  </td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

code for rss_eggeio.php file to upload to admin

 

<?php 
//require_once(DIR_WS_FUNCTIONS . 'google_base_functions.php');
$googlebase=true; //enable google base
$dryrunText=GOOGLE_DRY_RUN; //whether or not execute actual upload to both or stop at file generation
if ($dryrunText=='false')$dryrun=0;
if ($dryrunText=='true')$dryrun=1;
$limit=''; 
if (GOOGLE_LIMIT_COUNT != ''){
$limit=' LIMIT '.GOOGLE_LIMIT_COUNT; //nice to limit number of posts for debug delete for production
}
//CHANGE PARAMETERS BELOW///
$feedDirectory = "../feeds/"; //"CHANGEME-full-path-to-file-with-777-dir-and-file-permissions.yahoo-outfile.txt";
$siteUrl=HTTP_CATALOG_SERVER; //Your site URL i.e. http://www.mysite.com Site URL
$feedUrl=HTTP_CATALOG_SERVER.'/feeds/'; //URL to $OutFile i.e. http://www.mysite.com/feeds/ 
$imageUrl = HTTP_CATALOG_SERVER.'/images/'; //Base URL for images i.e. http://www.mysite.com/images/
$feedTitle=STORE_NAME.' '; //Feed Title i.e. My Company Feed
$feedDescription='Products available at '.STORE_NAME; //Feed Title i.e. My Company Name
// Change to 'false' to disable the use of SEO
define('SEO_ENABLED','true');
if(SEO_ENABLED=='true'){
  $productURL = 'product_info.php';   // ***** Revised for SEO
$productParam = "products_id=";   // ***** Added for SEO
}else{
$productUrl = HTTP_CATALOG_SERVER.'/product_info.php?products_id='; //Base url for products
}

$languageGB='en-us';
$currency=GOOGLE_BASE_CURRENCY; //ISO Currency code i.e. GBP, EUR
$locationCity=''.GOOGLE_BASE_CITY.' '; //location of the producti.e. New York
$locationState=''.GOOGLE_BASE_COUNTY.' '; //State i.e. CA 
$locationZip=''.GOOGLE_BASE_POSTCODE.' '; //ZIP
$locationCountry='GB';//COUNTRY
$ttl=60; //Time to expiration in days minimum 30 max 90
$paymentAccepted=array('Cash','Visa','MasterCard','AmericanExpress'); // these values should be the same as on google base xml feed spec
$locationAddress=''.STORE_NAME_ADDRESS.' ';

//GOOGLE SPECIFIC Settings
$destination_file = $fileGoogle;  //the upload file name specified on google base
$ftp_server = "uploads.google.com"; //google ftp server
$ftp_user_name = GOOGLE_BASE_FTPUSER; //ftp user name
$ftp_user_pass = GOOGLE_BASE_FTPPASS; //ftp password 

//echo $ftp_user_pass.'<br>'.$ftp_user_name;
$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 pd.products_description !='' and p.products_status=1");	  

if(SEO_ENABLED=='true'){
 //********************
 // Modification for SEO
 // Since the ultimate SEO was only installed on the public side, we will include our files from there.
 require_once('../includes/configure.php');
 require_once('../includes/filenames.php');
 require_once('../includes/database_tables.php');
 $languages_id = 1;   // CHANGEME - Change this to the id of your language.  BY default 1 is english


 include_once('../' .DIR_WS_CLASSES . 'seo.class.php');
 $seo_urls = new SEO_URL($languages_id);

//rewind the datasetif($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)){	
$descript=$row['products_description'];
//$descript=str_replace('<BR>','<BR>',$descript);
$output.='	<item>'."\n";	
$output.='		<title>'.cleanText(xmlentities(strip_tags(str_replace('&','and',$row['products_name'])))) .'</title>'."\n";	
$output.='		<description>'.cleanText(xmlentities(str_replace('&','and',$descript)))."</description>\n";	
$output.='		<link>'.tep_href_link_seo('product_info.php', 'products_id=' . $row['products_id']) .'</link>'."\n"; 	
$output.='		<g:image_link>'.$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($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, $fileGoogle );
if ($result==true)
echo "We have created and uploaded to Google Base $fileGoogle  file<br>";
}else{
if ($result==true) echo "You are currently on a dry run so $fileGoogle file has <b><u><i>NOT</i></u></b> uploaded to Google Base <br>";
}
} 

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


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, $fileGoogle ){	
// set up basic connection	
$conn_id = ftp_connect($ftpservername);	
if ( $conn_id == false )	
{	
echo "FTP open connection failed to $ftpservername <BR>Please try again in 15 minutes.\n";	
exit;
}		
// 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 to upload $fileGoogle - please resubmit!<BR>\n";	
return false;	
}
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 );
}
function cleanText($text)
{
// strip all non alphanum or -
$clean = utf8_encode(ereg_replace('/[^A-Za-z0-9\s\s+]/', '', utf8_decode($text)));
$clean = str_replace('Â','',$clean);
return $clean;
}	 
function tep_href_link_seo($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);
 }
?>


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Hi i just recived a message from google about the new required product attibute "condtion", i have decided to manually add this as a new product field, what do i need to do with my feed in order dor it o read this new product field (if anything )

Share this post


Link to post
Share on other sites

This is already available on the latest version.

 

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

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;
?>


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

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

×