Jump to content


Photo

Automatic Google Base Export File


  • Please log in to reply
17 replies to this topic

#1 mikemar921

mikemar921

    Hey, Look - I can change this now!!! :D

  • Members
  • PipPipPipPipPipPip
  • 512 posts

Posted 13 April 2010 - 10:37 PM

Download this script and upload it to your store's main directory (the directory where init.php is located). Then, point Google to the URL and that's it! Google will fetch it, and it will return all your product data!

Attached File  gfeed.php   5.62KB   355 downloads

Also available on GitHub. Social coding! Yeah!

Make sure all your products have a short description because this is a required attribute for Google!

If the feed is not fully imported, perhaps you need to change encoding here:

echo '<?xml version="1.0" encoding="UTF-8"?>
You may try to change UTF-8 to ISO-8859-1 or the one that has all your language's symbols.

Here's a screenshot of Google Merchant Center with sample feed settings:

feed_setup.jpg


------8<-----The following is needed if you want to have your own categories (taxonomy) ------>8-----

Google suggests that you supply product type with your data (according to their data quality report).

I found three categories that my products are a part of.

In order to add this to the file (the categories have to be all the same for all products in your store):

Find this code in the file:


echo "
		<item>
			<g:id>$id</g:id>
			<title>$title</title>	
			<link>$link</link>
			<g:price>$price</g:price>
			<g:condition>new</g:condition>
			<description>$description</description>
			<g:brand>$brand</g:brand>
			<g:image_link>$image_link</g:image_link>
			<g:quantity>$quantity</g:quantity>
		</item>";

At the very end, you can add another type, which is the product type Google tag.

So, the code would look something similar to this:


echo "
		<item>
			<g:id>$id</g:id>
			<title>$title</title>	
			<link>$link</link>
			<g:price>$price</g:price>
			<g:condition>new</g:condition>
			<description>$description</description>
			<g:brand>$brand</g:brand>
			<g:image_link>$image_link</g:image_link>
			<g:quantity>$quantity</g:quantity>
			<g:product_type>Full Taxonomy path 1</g:product_type>
			<g:product_type>Full Taxonomy path 2</g:product_type>
			<g:product_type>Full Taxonomy path 3</g:product_type>
		</item>";

You can go to this Google page, and it has a category tree that you can find your product in (Taxonomy).

You can enter as many as you want. Make sure to copy the XML Taxonomy and put that between the product type tags.

I set my Google account to fetch this daily. This means that Google will have a daily refresh of the data that I have in my store.

Post here if you have questions regarding this.

Thanks
Mike

#2 David Frost

David Frost

    Avactis Support Engineer

  • Administrators
  • PipPipPipPip
  • 144 posts

Posted 15 April 2010 - 06:00 PM

Hey, thanks, I actually wanted to add the script here too :) Do you think product_type is required? I couldn't find it in the specs.
David
Avactis Support Team

#3 mikemar921

mikemar921

    Hey, Look - I can change this now!!! :D

  • Members
  • PipPipPipPipPipPip
  • 512 posts

Posted 15 April 2010 - 06:11 PM

Thanks again David for creating that! I don't think that it is required for a product type to be defined. But, in the data quality details, it does show that for however many products you have, you do not have a product type defined. In the documentation I found at Google, it says that if you use that, it will help improve your products ranking. I wanted to assign the values because it said that my products were missing that, and that if it was provided, it may help users find the items more easily. Thanks again! Mike

#4 David Frost

David Frost

    Avactis Support Engineer

  • Administrators
  • PipPipPipPip
  • 144 posts

Posted 16 April 2010 - 06:21 PM

Added some more work for MySQL server and now the feed has product_type with the product's category name :lol: (Top post updated too.)
David
Avactis Support Team

#5 mikemar921

mikemar921

    Hey, Look - I can change this now!!! :D

  • Members
  • PipPipPipPipPipPip
  • 512 posts

Posted 03 May 2010 - 12:22 PM

David, I was going through and making some updates to the code. When I looked at the executed statements in my web browser (using View Source), I found out that there were a lot of items that did not have the full URL for the image. I then went into the database and looked in the product_attributes table and found out that there were some items with a full path to the image (including the http://) and there were some items with just the file name (somepicture.jpg). I went through and modified the values for attribute_id 9 and 10 and added the full path (including the http://). Is this because when the items were added, it only stored the image name and now, in later versions, it stores the full path? The images always showed up in my online store. But, they were showing up as broken in Google Base (because it was only showing the picture file name; not the full path). I went ahead and uploaded another copy and now all the pictures are showing up. I just thought that I would post this here in case someone else is not having all of the images show up in Google Base. Thanks Mike

#6 David Frost

David Frost

    Avactis Support Engineer

  • Administrators
  • PipPipPipPip
  • 144 posts

Posted 03 May 2010 - 03:46 PM

I went ahead and uploaded another copy and now all the pictures are showing up.

Can you please elaborate on what you did, exactly? I don't think I understand...

Do you think it would be useful to check every $image_link for being a full URL (via urldecode()) and if it's not, attach it to image folder URL?
David
Avactis Support Team

#7 mikemar921

mikemar921

    Hey, Look - I can change this now!!! :D

  • Members
  • PipPipPipPipPipPip
  • 512 posts

Posted 03 May 2010 - 04:43 PM

David,

I uploaded the updated copy of the gfeed.php to my server and manually ran it via Google Base.

When I viewed the gfeed.php in my browser, I received the following results:

<item>
			<g:id>57</g:id>
			<title>Civil War Star</title>	
			<link>http://www.mystorelink.net/store/product-info.php?Pattern-pid57.html</link>
			<g:price>8.5</g:price>
			<g:condition>New</g:condition>
			<description>Blah.</description>
			<g:image_link>image1.JPG</g:image_link>
			<g:quantity>469</g:quantity>
			<g:product_type>Pattern</g:product_type>
		</item>

Because the information between the
<g:image_link>
tags was not a full URL, Google Base was not able to display the images.

I went into the database in the product_attributes table and queried the table for attribute_id=9 or 10. The results were a mix of full URL's and only the image file names. I modified the lines that only had the image file names to include the full URL.

So, the image1.JPG is now stored as http://www.mystoreli...ages/image1.JPG. I believe that the attributes for 9 and 10 are the small and large images. When I modified my tables, I went into the storefront and verified that the images are loading correctly. So, it appears that having the full URL in the database for attribute_id 9 and 10 does not cause any issues. My only concern is if the storefront is https enabled when a customer is signed in. Will having these http calls in the database cause the page to display a warning that the image is not secure.

Anyway, after I modified the database, I reran the gfeed.php in my browser and received the following result:

<item>
			<g:id>57</g:id>
			<title>Civil War Star</title>	
			<link>http://www.mystorelink.net/store/product-info.php?Pattern-pid57.html</link>
			<g:price>8.5</g:price>
			<g:condition>New</g:condition>
			<description>Blah.</description>
			<g:image_link>http://www.mystorelink.net/store/avactis-images/image1.JPG</g:image_link>
			<g:quantity>469</g:quantity>
			<g:product_type>Pattern</g:product_type>
		</item>

As far as your suggestion, I think that it would be good to check for the full URL.

Do you know if the images were added differently in different version of Avactis? (Were images added as full URL paths in earlier versions and then changed to only storing the image file name later - or vise versa?)

Is there a preference as to what should be stored in the database for attribute_ids 9 and 10 (full URL or file name only)?

Thanks
Mike

#8 seanbo

seanbo

    Novice

  • Members
  • PipPip
  • 26 posts

Posted 03 May 2010 - 10:17 PM

Can you please elaborate on what you did, exactly? I don't think I understand...

Do you think it would be useful to check every $image_link for being a full URL (via urldecode()) and if it's not, attach it to image folder URL?


I have the same issue as the OP...

See below image_link tags:
<item>
  <g:id>202</g:id>
  <title>Brooks Womens Adrenaline GTS 10</title>	
  <link>http://www.besttrigear.com/product-info.php?Brooks-Womens-Adrenaline-GTS-10-pid202.html</link>
  <g:price>95.00</g:price>
  <g:condition>new</g:condition>
  <description>Always the leader, the Adrenaline� GTS 10 has left the pack even further behind.</description>
  <g:brand>Brooks</g:brand>
  <g:image_link>http://www.besttrigear.com/avactis-images/Adrenaline10120064416o.jpg</g:image_link>
  <g:quantity>10</g:quantity>
  <g:product_type>Womens Shoes</g:product_type>
</item>
<item>
  <g:id>203</g:id>
  <title>Brooks Mens Addiction 8</title>	
  <link>http://www.besttrigear.com/product-info.php?Brooks-Mens-Addiction-8-pid203.html</link>
  <g:price>98.99</g:price>
  <g:condition>new</g:condition>
  <description>Cravings for the Addiction� 8 are sure to arise, thanks to the soft yet long-lasting cushioning of MoGo.</description>
  <g:brand>Brooks</g:brand>
  <g:image_link>Addiction8110045994o.jpg</g:image_link>
  <g:quantity></g:quantity>
  <g:product_type>Mens Shoes</g:product_type>
</item>

Also, some image_links have http and some have https...I assume that;s because I had my storefront in https mode when I created them?!

<item>
 <g:id>181</g:id>
  <title>Nathan Sport Cap</title>	
  <link>http://www.besttrigear.com/product-info.php?NathanSportCap-pid181.html</link>
	<g:price>5.00</g:price>
	<g:condition>new</g:condition>
	<description></description>
	<g:brand>Nathan</g:brand>
	<g:image_link>https://www.besttrigear.com/avactis-images/4000n-large.jpg</g:image_link>
	<g:quantity>0</g:quantity>
	<g:product_type>Accessories</g:product_type>
</item>

Further, I had some entries with a "/" in the description which broke the RSS in a nasty way.

#9 Technology Ideas

Technology Ideas

    Expert

  • Members
  • PipPipPipPipPip
  • 397 posts

Posted 03 May 2010 - 10:29 PM

Davids idea of checking every $image_link for being a full URL via urldecode() and if it's not, attach it to image folder URL is the fix.

Regards,
Andrew Baker | http://www.technologyideas.com.au

#10 David Frost

David Frost

    Avactis Support Engineer

  • Administrators
  • PipPipPipPip
  • 144 posts

Posted 04 May 2010 - 08:24 AM

Product image URL fix added to the script. Download from the top post!
David
Avactis Support Team

#11 mikemar921

mikemar921

    Hey, Look - I can change this now!!! :D

  • Members
  • PipPipPipPipPipPip
  • 512 posts

Posted 04 May 2010 - 06:32 PM

David, Do you know why some entries contain the full URL and other ones contain just the image file name? Thanks Mike

#12 David Frost

David Frost

    Avactis Support Engineer

  • Administrators
  • PipPipPipPip
  • 144 posts

Posted 05 May 2010 - 06:21 AM

o_O You mean the new script, with parse_url() function? No idea... I tested it on just a couple new products, perhaps your config is different? Insert print_r( $settings ); die(); before the big query and see if there will be a correct HTTP_URL setting.
David
Avactis Support Team

#13 mikemar921

mikemar921

    Hey, Look - I can change this now!!! :D

  • Members
  • PipPipPipPipPipPip
  • 512 posts

Posted 05 May 2010 - 08:49 AM

David, I was not referring to your script. I was wondering why in the database some items have a full URL and some items just have the image file name. (Nothing to do with your script.) I haven't had a chance to test out your script above yet, but I will be doing that soon. Thanks Mike

#14 David Frost

David Frost

    Avactis Support Engineer

  • Administrators
  • PipPipPipPip
  • 144 posts

Posted 06 May 2010 - 02:21 PM

Well, apparently the latest version saves only file names to the database, and if some products have full image URLs in there, it means the old versions of Avactis did save them that way :) But from what I know, the full URL wasn't used anyway, only the filename was used, and it was attached to the images folder URL from store settings (initialized at boot time). So the latest version just dropped the unnecessary part.
David
Avactis Support Team

#15 juiceyjc

juiceyjc

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 22 October 2010 - 07:49 AM

Well, apparently the latest version saves only file names to the database, and if some products have full image URLs in there, it means the old versions of Avactis did save them that way :) But from what I know, the full URL wasn't used anyway, only the filename was used, and it was attached to the images folder URL from store settings (initialized at boot time). So the latest version just dropped the unnecessary part.


Hi,
So I tried the original way (exporting using the program) to get my products into Google Base. This seems to work except there are no images with it.

So I thought I would give this feed a try. Seems to work, except when I look at it for some reason it duplicated every product. Then when I try to upload it using Google Base, the program only seems to grab some of the items. Is there something I am missing?

Here is my link:

http://www.thecomfor...t.com/gfeed.php

#16 Ilya Vassilevsky

Ilya Vassilevsky

    Avactis Support

  • Administrators
  • PipPipPipPip
  • 198 posts

Posted 27 October 2010 - 08:16 PM

The script has been updated to support multiple categories for each product. Download from the first post, as usual.

The script is now on GitHub:

http://github.com/Av...t-Feed-Exporter

Social coding FTW!

#17 pb-moto-d

pb-moto-d

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 26 March 2012 - 06:14 AM

The script has been updated to support multiple categories for each product. Download from the first post, as usual.

The script is now on GitHub:

http://github.com/Av...t-Feed-Exporter

Social coding FTW!


Hi,

I've started using the feed and all works well. However when looking at data quality i get the following message;

Critical Errors: The errors below are carefully monitored and may result in account suspension in United Kingdom.

Missing Unique Product Identifiers (32 items)
Some of your items do not have valid unique product identifiers. Please add valid unique product identifiers. Otherwise, it's possible that none of your items will appear in Google search results.

Does anyone know of a method that could fix this?

Thanks in advance.

#18 Lana

Lana

    Devotee

  • Members
  • PipPipPipPip
  • 123 posts

Posted 27 March 2012 - 07:12 AM

Hi!

It is a known problem. Google updated their requirements. Please, contact our support team for help:

http://avactis.com/support.php