Article | Date posted : 7 June, 2013 | Updated on : 26 April, 2014

Google Merchant How To Setup A Live XML Data Feed With MySql and PHP

Sponsored Links

Setting up a live data feed for Google Merchant (Google Shopping) can be tricky if you don’t know how to set it up. I could not find one topic that covered from a to z how to set up a Google Merchant Feed. This article will cover how to create a database, retrieve information using PHP and automatically generate a Google Merchant XML feed.

Requirements :

  • basic knowledge of PHP
  • basic knowledge of MySQL

First go and get yourself a Google Shopping Account and fill out all your details for registration (It’s a very simple process). You can also connect ¬†your Google Adwords account to your Google Shopping account.

Now that you have already created an account lets delve on in-depth information on how to set-up a live data feed. If you already have a database with products please ignore the next part and go to required fields and explanation.

Step One : Setting up a MySQL database

Below as an example, I have created a simple MySQL code for you to use. It holds a bare minimum requirements for Google Shopping. This example does not cover products such as clothing, I would suggest after reading this article to have a look at what additional fields you need to add, please check the xml example here.

  • Login to your MySQL CMS system, most likely phpMyAdmin
  • Go to the tab SQL
  • Copy and Paste the below code into the text area and click on Go

phpmyadmin import sql code

Required fields and explanation:
If you need an explanation to what all these fields are, simply look at the support files here. Within the xml file as an example you will see what the minimum requirements are for publishing products into Google Shop.

Once you have created your table, insert some data as a test example.

Step Two : Generating our XML file

Below is an example I have used for generating an example file. If you have imported the table from step one, than the php code below will generate the correct information. If not than most likely you want to change the fetched arrays within the script.

Save this file as index.php and upload it to a folder such as remember to htaccess this folder so that your data can’t be downloaded by others. Browse to your folder, login and now you can see your xml data.

In Google Shopping Centre navigate to data feed, and enter in a name for example shopping-feed.xml and click on continue. In the second column under upload, click on Monthly/Weekly upload, here you enter in your URL, username and password for which you have added to your htaccess file, select the recurrence of your data download, for example every week on a Monday.

And that’s it. All done, now you have set up a live data feed as to which you only have to update in your server’s database and not multiple xml or text files.

Require additional help, contact me below?

[contact-form][contact-field label=’Name’ type=’name’ required=’1’/][contact-field label=’Email’ type=’email’ required=’1’/][contact-field label=’Website’ type=’url’/][contact-field label=’Comment’ type=’textarea’ required=’1’/][/contact-form]

Sponsored Links


2 thoughts on “Google Merchant How To Setup A Live XML Data Feed With MySql and PHP

  1. Hello!

    I have problem to edit the code.

    The database name: masd_comerce
    The User name: masd_feed
    Password: 12345
    The name of the table that has the Product ID, name, price, quantity …: id_auctions
    The name of the table that has the image link and Product ID …: id_imag

    How would the code? Thank U!

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow me on Google+

Google Shopping Data Feed Generator

Sponsored Links

Hire Me