Jump to content
gottaloveit

Automatically send data feed to Froogle

Recommended Posts

A new version has been uploaded with these changes:

 

- Changed expiration date, as mentioned by kmb40, to shorten the expiration date and prevent google errors

- Changed how manufacturer and manfacturer ID (now product model) are handled.

- Corrected spelling mistake for manufacturer (found by mdtaylorlrim)

- Fixed installation instructions for the feeder link as noticed by user buysellleasetrade

- Added code to exclude products listed as Quotes from that contribution

- Added code to handle product attributes

- Added option to easily turn tax calculation on and off

- Added option to skip some manufacturer names

- Added Version Checker code to allow easy checking for updates

Share this post


Link to post
Share on other sites

Jack,

I recently had Google complain about bad image links in my feed. The problem was that some of my products with no images had empty strings rather than NULL values in the database. My temporary workaround was to fix the database, but my guess is that something that I use for editing products changes the value from NULL to ''.

 

CONCAT( '" . $imageURL . "' ,products.products_image) AS image_url,

 

The fragment of the SQL query above that pulls the image data relies on the behavior of the MySQL CONCAT function which returns NULL if any of the arguments are NULL. So, if products.products_image is NULL, image_url is NULL, but if products.products_image is '', image_url is set to $imageURL.

 

This line fixes the problem:

IF(products.products_image='', null, CONCAT( '" . $imageURL . "' ,products.products_image)) AS image_url,

 

--Glen

Share this post


Link to post
Share on other sites

Thanks for posting the code. It may help others that are missnig images.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

One more thing... the since v2.0, the googlefeeder.php code assumes that the shop is stored in the root directory and that the images directory is directly below it using the following code:

 

$imageURL = 'http://' . DOMAIN_NAME . '/images/';

 

DOMAIN_NAME should actually be set to the shop's root directory, such as 'www.mydomain.com/catalog', so the variable name is a bit misleading. But since v2.x pulls in the shop's includes/configure.php, we can construct the image directory URL from information that is used by the shop, like this:

 

$imageURL = HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES;

 

Changes similar to this can be made for all directory references, eliminating the need to set DOMAIN_NAME at all. This would make the code more portable, as it would work correctly for all sites straight out of the box. One could also create an automatic test for Ultimate SEO URLs, but it would require a bit of rearranging of the code and a decision of whether to pull in all the shop configuration values, or just the ones needed.

 

Brute force method (read entire store configuration):

(insert after opening database connection)

// include the list of project database tables
 require(DIR_WS_INCLUDES . 'database_tables.php');

// set the application parameters
 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   define($configuration['cfgKey'], $configuration['cfgValue']);
 }

 

After this, you can use the following to determine whether Ultimate SEO URLs is installed:

 

if (SEO_ENABLED == 'true') {
 (do something)
} else {
 (do something else)
}

 

I'll leave the rest as an exercise to the reader, though I may update the code to pull as much as possible from the configuration at some point.

 

--Glen

Share this post


Link to post
Share on other sites

A new version has been uploaded with these changes:

 

- Changed expiration date, as mentioned by kmb40, to shorten the expiration date and prevent google errors

- Changed how manufacturer and manfacturer ID (now product model) are handled.

- Corrected spelling mistake for manufacturer (found by mdtaylorlrim)

- Fixed installation instructions for the feeder link as noticed by user buysellleasetrade

- Added code to exclude products listed as Quotes from that contribution

- Added code to handle product attributes

- Added option to easily turn tax calculation on and off

- Added option to skip some manufacturer names

- Added Version Checker code to allow easy checking for updates

 

Hi Jack:

Now I update to the lastest version, GG feed still disapproved.

 

link title description expiration_date price image_link genre id weight manufacturer model_number product_type currency quantity condition

http://www.xxxxx.com/product_info.php?currency=USD&products_id=1017 "Evisu hoody for hip hop No.10508" "size M/L/XL/XXL/XXXL color black/white" 2010-01-28 52.00 http://www.xxxxx.com/images/10508_1_small.jpg Evisu, Hoody 1017 0.00 Gms. 10508 Hoody USD 100 New

 

Would you please help to give your advice asap?

 

Thanks & Best Regards,

Sunrise99

Edited by sunrise99

Share this post


Link to post
Share on other sites

Jack, great contribution. really getting to love this oscommerce stuff. I'm fairly new to it.

 

I have 2 stores and one it works with the other it does not. The only difference is the version of Ultimate SEO_URL I have.

 

The store that works has Ultimate SEO 2-2.2d-5 along with your latest google feeder posted on Christmas this year.

 

The store that is not working has Ultimate SEO Ultimate Seo Urls 2.1d STABLE FINAL r164 which claims to be better than 2.2d-5.

 

This is the error I'm getting:

 

Fatal error: Call to undefined function tep_db_query() in /home/content/66/4733866/html/absolutelyscooterparts/catalog/includes/classes/seo.class.php on line 857

 

Is this something I can change by changing a line of code or should I switch the version of Ultimate SEO?

 

Any help would be greatly appreciated.

Edited by IWAS

Share this post


Link to post
Share on other sites

Jack, great contribution. really getting to love this oscommerce stuff. I'm fairly new to it.

 

I have 2 stores and one it works with the other it does not. The only difference is the version of Ultimate SEO_URL I have.

 

The store that works has Ultimate SEO 2-2.2d-5 along with your latest google feeder posted on Christmas this year.

 

The store that is not working has Ultimate SEO Ultimate Seo Urls 2.1d STABLE FINAL r164 which claims to be better than 2.2d-5.

 

This is the error I'm getting:

 

Fatal error: Call to undefined function tep_db_query() in /home/content/66/4733866/html/absolutelyscooterparts/catalog/includes/classes/seo.class.php on line 857

 

Is this something I can change by changing a line of code or should I switch the version of Ultimate SEO?

 

Any help would be greatly appreciated.

 

EVERY script in osCommerce should have tep_href_link() available as it is a core function of osCommerce. If tep_href_link() is not available then the script is not calling application_top.php as it should.

 

If it is a cron job just include application_top.php and application_bottom.php at the top and bottom of the file. as you should .. then the cron is just written like ...

 

* * * * * * wget -q http://www.somesite.com/somefolder/somefile.php >/dev/null 

Share this post


Link to post
Share on other sites

Jack, great contribution. really getting to love this oscommerce stuff. I'm fairly new to it.

 

I have 2 stores and one it works with the other it does not. The only difference is the version of Ultimate SEO_URL I have.

 

The store that works has Ultimate SEO 2-2.2d-5 along with your latest google feeder posted on Christmas this year.

 

The store that is not working has Ultimate SEO Ultimate Seo Urls 2.1d STABLE FINAL r164 which claims to be better than 2.2d-5.

Not everything said on this forum is to be taken as correct. I suggest switching to 2.2d-5.

Share this post


Link to post
Share on other sites

Thank you for this great contribution. I have been using it since the previous version.

My current feeds are for the United States market. I want to create a new feed for the UK market. I know I need to create unique product IDs for my US market. How do I do that? Currently, all my UK feeds will overwrite the US feeds. Any advice is greatly appreciated.

Share this post


Link to post
Share on other sites

Thank you for this great contribution. I have been using it since the previous version.

My current feeds are for the United States market. I want to create a new feed for the UK market. I know I need to create unique product IDs for my US market. How do I do that? Currently, all my UK feeds will overwrite the US feeds. Any advice is greatly appreciated.

Make a copy of the googlefeeder.php file and name it something like googlefeeder_uk.php. Then edit the settings in that file to make it UK-specific. You'll need to create another feed entry in your googlebase account. Setup another cron job to run the second file and that should do it.

Share this post


Link to post
Share on other sites

Make a copy of the googlefeeder.php file and name it something like googlefeeder_uk.php. Then edit the settings in that file to make it UK-specific. You'll need to create another feed entry in your googlebase account. Setup another cron job to run the second file and that should do it.

 

Thxs for the fast response. This is exactly what I did before. All the feeds for different market actually went through and all products were accepted. Instead of seeing one set of products for US and another for UK, I always only see the active product of the last feed that was uploaded. I think the products were still listed in both markets. But can only see one set of performance report.

 

If I am not wrong, I think all the feeds are only generating one set of unique product ID. I have checked the currency is they are correctly converted.

Share this post


Link to post
Share on other sites

Thxs for the fast response. This is exactly what I did before. All the feeds for different market actually went through and all products were accepted. Instead of seeing one set of products for US and another for UK, I always only see the active product of the last feed that was uploaded. I think the products were still listed in both markets. But can only see one set of performance report.

 

If I am not wrong, I think all the feeds are only generating one set of unique product ID. I have checked the currency is they are correctly converted.

I thought that all products, regardless of target market, had to have unique id's. If this is the case you will need to edit your googlefeeder_uk.php file to concatenate an identifier to the id of the UK products. Like, '156' for the US product and 'UK156' for the same product offered in the UK feed.


Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Share this post


Link to post
Share on other sites

I thought that all products, regardless of target market, had to have unique id's. If this is the case you will need to edit your googlefeeder_uk.php file to concatenate an identifier to the id of the UK products. Like, '156' for the US product and 'UK156' for the same product offered in the UK feed.

 

Thxs for the reply. What codes should I change to get this effect?

Share this post


Link to post
Share on other sites

Thxs for the reply. What codes should I change to get this effect?

Well, I consider Jack to be the real expert on this, but if I were doing this for myself the first attempt at this would be here...

 

Around line 300 in your newly created googlefeeder_UK.php file suggested by Jack, find this:

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

 

And change it to this:

  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" .
           "UK_" . $row->id;
   }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" .
     		"UK_" . $row->id;
   }

 

 

Keeping in mind to disable the ftp option first so you can verify the output in the feed file that is created. And again, I ain't the expert here... I would think it is not really this simple. Thinking about it, you should also convert the Dollars to Pounds or Euros as well. After all, would you not want the cost to be in the currency of the target country?


Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Share this post


Link to post
Share on other sites

Thanks for the advice. Your suggestion is working 100% perfectly.

 

I found a spelling mistake in the googlefeeder.php file. If I am not wrong, "OPTIONS_DEFAULT_FFEED_LANGUAGE" should be "OPTIONS_DEFAULT_FEED_LANGUAGE".

 

Well, I consider Jack to be the real expert on this, but if I were doing this for myself the first attempt at this would be here...

Share this post


Link to post
Share on other sites

A quick suggestion. The instructions say to "Upload all of the files in the catalog directory to the correct

location on your server", except feeders.php goes in language/english(etc.)/feeders.php not languages/feeders.php as it sits in the latest package. This might be confusing for the less experienced. Just thought Id point it out.

Share this post


Link to post
Share on other sites

Newton and Zach - Thanks for pointing out the mistakes. I will correct them in the next version.

Share this post


Link to post
Share on other sites

I don't recall anyone mentioning it before so I never thought to add the option. It's not a quick change though so I will put it on the list for a future update.

 

Hi Jack,

 

Just installed version 2.5 - does this include this functionality yet ?

 

Thanks


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

Just installed version 2.5 - does this include this functionality yet ?

Assuming you are referring to the tax, no, that's not in there, and probably won't be. I looked at it but there are too many code pieces to call in from other parts of the shop. It can be done but is not a simple change and not something I would spend the time on doing. Maybe someone else will decide to takcle it though.

Share this post


Link to post
Share on other sites

Hi Jack:

Thanks for your Great contribution.

 

Now I update to the lastest version, GG feed still disapproved.

Please kindly see the following feed file.

 

link title description expiration_date price image_link genre id weight manufacturer model_number product_type currency quantity condition

http://www.xxxxx.com...roducts_id=1017 "Evisu hoody for hip hop No.10508" "size M/L/XL/XXL/XXXL color black/white" 2010-01-28 52.00 http://www.xxxxx.com...508_1_small.jpg Evisu, Hoody 1017 0.00 Gms. 10508 Hoody USD 100 New

 

Would you please help to give your some suggestion asap?

 

Thanks & Best Regards,

Sunrise99

Share this post


Link to post
Share on other sites

It could be the quotes in the listing. In your datafeed, you should be able to copy the url and paste it into a browser (or just click on it) to view that product. If you can't, then that is what the problem is. Otherwise, as mentioned previously, you have to chek your google account to see what the error is.

Share this post


Link to post
Share on other sites

i just realize that the feed is not displaying images. I have ULTIMATE Seo Urls 5 - by FWR Media installed. It was working when I installed Ultimate SEO 2-2.2d-5 previously.

Share this post


Link to post
Share on other sites

That's an issue with that contribution. He doesn't code his contributions to be compatible so you will find a number of problems like that. There's no advantage to using that contribution over 2.2 but if you want to use it and have it work, you will need to ask in the support thread for it.

Share this post


Link to post
Share on other sites

That's an issue with that contribution. He doesn't code his contributions to be compatible so you will find a number of problems like that. There's no advantage to using that contribution over 2.2 but if you want to use it and have it work, you will need to ask in the support thread for it.

 

Don't talk rubbish Jack! you'll just make yourself look stupid.

 

The real issues are: -

 

osCommerce uses a little thing called tep_href_link() Jack .. ever heard of it? it is the standard function seen all over osCommerce that is used to get links. Now you know eh.

 

This contribution like the XML feed that you put up DOES NOT use tep_href_link() as defined by application_top.

 

YOU hardcode in series 2 seo urls and therefore make the thing hardcode reliant on one particular url rewriter, YOU create incompatibility no one else.

 

For the last time (hopefully) all you have to do when writing these things is to use wget in the cron so you can access the file via HTTP like ..

 

* * * * * * wget -q http://www.somesite.com/folder/somefile.php >/dev/null

 

You can then properly call application_top.php at the start and application_bottom at the end and all the osCommerce functions will be available.

 

How dare you suggest "He doesn't code his contributions to be compatible" when it is YOU who is incapable of using standard oscommerce functions and hardcoding the damn thing.

 

If you are going to hijack other peoples contributions then try and get it right occasionally.

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

×