Publishing Product Data to Google Shopping

KonaKart provides the functionality to publish product data to Google Shopping. You can execute this from either a command line utility or from the KonaKart Admin App. Since this might be a process you would want to run on a regular basis to keep your products in sync with the items in Google Shopping, it might be appropriate for you to execute the command line utility from your system scheduler at a frequency that makes sense for your shop's product catalog. Note that published products "expire" in Google Shopping after 30 days, so bear this in mind when scheduling publishing runs.

Note that prior to v5.4.0.0 of KonaKart, products were published to Google using their Google Base APIs. Google announced that as from 1st June 2011 the Google Base APIs would no longer be supported. Hence, the publishing mechanism used in KonaKart was changed (from v5.4.0.0) to use the new Google Shopping Content APIs. The only difference from a user's perspective is that with the new Shopping Content APIs the KonaKart Administrator must specify a Google Account number (in addition to the Google username and password as before) but you no longer need to define a Google API key or a Store Location.

Products are published with the target country defined as the shop where the store resides with product descriptions published only in the default language for the store.

Neither inactive or invisible products are published.

Setting Up Google Shopping

Before you can use this feature you must create an account in Google and define these configuration parameters in the KonaKart Admin App. At the time of writing, these accounts are free to create. See Google Merchant Center for details.

KonaKart Admin Application

KonaKart Admin Application - Data Feeds Configuration

From v5.4.0.0 you no longer need to obtain a Google Base API key for "Installed Apps" but the configuration variable has been left to support existing customers who may be using it and for future use. If you need an API key you can obtain one from Google API Keys .

Also from v5.4.0.0 you no longer need to specify a "Store Location" but again this configuration variable has been left to support existing customers who may be using it and for future use.

Customizing the Google Shopping Interface

It's easy to customize the way your products are loaded into Google Shopping. The simplest technique is to specialise KonaKart's PublishProductsGoogle class and modify the behaviour to suit your needs.

An example of how you might do this is provided in the download package under the googleBase directory. See src/com/konakartadmin/bl/CustomPublishProductsGoogle.java which gives you an example of how to specialise PublishProductsGoogle. Once you have specialised PublishProductsGoogle you need to define the name of your class in your konakartadmin.properties file so that KonaKart knows which implementation to use. The class you define could be the example class called CustomPublishProductsGoogle if you like but it could be any class of your own if you prefer). You need to uncomment the line beginning "#konakart.admin_manager.GooglePublishPoductsMgr" then change the "com.konakartadmin.bl.PublishProductsGoogle" class definition to your own.

You also need to compile your new class. An ANT build file is provided for you to use to compile CustomPublishProductsGoogle, after which you can use the deploy option to copy your class to your konakartadmin/webapps/WEB-INF/classes directory so that it can be loaded by KonaKart. An example of using the ANT build file for this purpose is as follows:


C:\Program Files\KonaKart\googleBase> ..\custom\bin\kkant
Buildfile: build.xml

clean:
     [echo] Cleanup...

compile:
     [echo] Compile the example
    [mkdir] Created dir: C:\Program Files\KonaKart\googleBase\classes
    [javac] Compiling 1 source file to C:\Program Files\KonaKart\googleBase\classes

build:

BUILD SUCCESSFUL
Total time: 11 seconds

C:\Program Files\KonaKart\googleBase> ..\custom\bin\kkant deploy
Buildfile: build.xml

deploy:
     [echo] Deploy the example to the konakartadmin webapp
    [mkdir] Created dir: 
            C:\Program Files\KonaKart\webapps\konakartadmin\WEB-INF\classes\com\konakartadmin\bl
     [copy] Copying 1 file to 
            C:\Program Files\KonaKart\webapps\konakartadmin\WEB-INF\classes\com\konakartadmin\bl

BUILD SUCCESSFUL
Total time: 0 seconds

Executing the Google Shopping Publishing Feed

There are two different ways to publish products in Google Shopping. One is automatically executed by KonaKart whenever changes are made to products in the application. The other is explicit execution of the process to publish products to Google.

If you want KonaKart to update the products published in Google whenever a change occurs to these products in KonaKart, you have to "Enable Google Data" in the Configuration section of the Admin App. If you only want to publish products at specific times, and not whenever changes occur to products inside KonaKart, you can disable Google Shopping. This enable Google Shopping setting in the configuration parameters only controls the automated updates to Google Shopping by KonaKart so even if you do not enable it, you can always run the full publish products process, whenever you like.

There are two ways to run the process to publish all products to Google Shopping as follows:

  • From the Admin App
  • From a Script

Publishing Products From the Admin App

Under the Tools Menu you will find the Data Feeds menu item. Once here, you will see the "Publish" option. When you click on the "Publish" button you will initiate a process that publishes your product to Google Shopping. Since this can take a very long time (the more products you have, the longer time it will take), this job executes in the background so that the Admin App user does not have to wait for it to complete before moving on to another task.

KonaKart Admin Application

KonaKart Admin Application - Tools > Publish Products

Publishing Products From Scripts

Scripts are provided for both Windows and Linux/Unix. These are located in the googleBase directory directly underneath the KonaKart home directory, and are called:

  • PublishProducts.bat (Windows)
  • PublishProducts.sh (Unix/Linux)

These scripts can be executed directly from the command line or from a system scheduling utility (such as cron on Unix).

The usage is the same on both platforms:


C:\Program Files\KonaKart\googleBase>PublishProducts.bat -?
===================================================================================================
Publish KonaKart Products in Google
For usage information enter ./PublishProducts.bat ?
===================================================================================================
Usage: PublishProducts
  -u  user           = KonaKart Admin User
 [-s  storeId]       = KonaKart Store Id (default storeId)
  -p  password       = KonaKart Admin Password
  -m  engine mode    = KonaKart Engine Mode (default 0 = Single Store)
 [-c  (true|false)]  = Shared Customers (default is false)
 [-ps (true|false)]  = Shared Customers (default is false)
 [-t  feed type]     = Data Feed Type (default 1 = Google)
  -r  max-prods      = read max-prods products from published store
 [-l  log file name] = log file name (default PublishProducts.log)
  -d                 = Enable debug mode

Example execution:


keller@swansea:~/konakart/googleBase$ ./PublishProducts.sh -u admin@konakart.com -p princess 
===============================================================================================
Publish KonaKart Products in Google
===============================================================================================

Published 28 products to Google
Products Published successfully