Magento Google Shopping Setup aka Google Base aka Google Content aka Google Merchant

Here's a quick (and hopefully easy) tutorial on how to properly setup Magento with Google Base aka "Google Shopping" or "Google Content" .

I know there is very limited help for Google Base/Shopping for Magento Community Edition 1.6 and 1.7 (and nothing official exists on any lower versions)...

The interested fact is, Magento is knowingly supplying a broken extension with 1.6 and 1.7--i.e. there is no way it will work unless you hack the core code; as we will below.

Hopefully, the community edition will get a working extension soon, just like the Magento Go version.

Anyhow... on to self help!

Step 1. Input your Google base account data

Go here:
System --> Configuration --> Google API

Account ID: YOUR ACCOUNT ID
Account Login: YOUR GOOGLE ACCOUNT USER NAME
Account Password: YOUR GOOGLE ACCOUNT PASSWORD
Account Type: Hosted or Google
Target Country: YOUR COUNTRY
Update Google Shopping Item when Product is Updated: (I usually keep this at "No" to speed up data input; otherwise you have to wait for google to update before product update is done)
Debug: No
Google Product Search: Default
Product Ads: Default
Commerce Search: Default

Step 2. Add required Google 'Product Type (category)'

Edit 'Category.php'

Go to Google to find the closest category/taxonomy to what you're selling

And copy the XML part, which you will paste below.

In your filebase:
app/code/core/Mage/GoogleShopping/Helper/Category.php

Find this:

class Mage_GoogleShopping_Helper_Category
{
    const CATEGORY_APPAREL  = 'Apparel & Accessories';
    const CATEGORY_CLOTHING = 'Apparel & Accessories > Clothing';
    const CATEGORY_SHOES    = 'Apparel & Accessories > Shoes';
    const CATEGORY_BOOKS    = 'Media > Books';
    const CATEGORY_DVDS     = 'Media > DVDs & Videos';
    const CATEGORY_MUSIC    = 'Media > Music';
    const CATEGORY_VGAME    = 'Software > Video Game Software';
    const CATEGORY_OTHER    = 'Other';
 
    /**
     * Retrieve list of Google Product Categories
     *
     * @return array
     */
    public function getCategories($addOther = true)
    {
        $categories = array(
            self::CATEGORY_APPAREL, self::CATEGORY_CLOTHING, self::CATEGORY_SHOES, self::CATEGORY_BOOKS,
            self::CATEGORY_DVDS, self::CATEGORY_MUSIC, self::CATEGORY_VGAME
        );
        if ($addOther) {
            $categories[] = self::CATEGORY_OTHER;
        }
        return $categories;
    }

Change to this:

<?php
class Mage_GoogleShopping_Helper_Category
{
    const CATEGORY_APPAREL  = 'Apparel & Accessories';
    const CATEGORY_CLOTHING = 'Apparel & Accessories > Clothing';
    const CATEGORY_SHOES    = 'Apparel & Accessories > Shoes';
    const CATEGORY_BOOKS    = 'Media > Books';
    const CATEGORY_DVDS     = 'Media > DVDs & Videos';
    const CATEGORY_MUSIC    = 'Media > Music';
    const CATEGORY_VGAME    = 'Software > Video Game Software';
    const CATEGORY_OTHER    = 'Other';
    const CATEGORY_MOTORVEHICLECARE    = 'Vehicles & Parts > Vehicle Parts & Accessories > Motor Vehicle Care';
 
    /**
     * Retrieve list of Google Product Categories
     *
     * @return array
     */
    public function getCategories($addOther = true)
    {
        $categories = array(
            self::CATEGORY_APPAREL, self::CATEGORY_CLOTHING, self::CATEGORY_SHOES, self::CATEGORY_BOOKS,
            self::CATEGORY_DVDS, self::CATEGORY_MUSIC, self::CATEGORY_VGAME, self::CATEGORY_MOTORVEHICLECARE
        );
        if ($addOther) {
            $categories[] = self::CATEGORY_OTHER;
        }
        return $categories;
    }

Change CATEGORY_MOTORVEHICLECARE and 'Vehicles & Parts > Vehicle Parts & Accessories > Motor Vehicle Care' to whatever you copied above in the Google Taxonomy page.

Create as many of these as you will need.

Edit the database table field

Now... the above Google taxonomy is long, hence the current table field structure of 40 character limit will not work on anything that is over that limit... Therefore we have to increase that from 40 to 255.

Go into phpMyAdmin or whatever, and change table googleshopping_types field category from 40 to 255 characters.

Step 2. Map existing, and create new Google base attributes.

Go here:
Catalog --> Google Content --> Manage Attributes

(if you don't already have an existing mapping)

Click 'Add Attribute Mapping'
Target Country: SELECT YOUR COUNTRY
Attribute Set: (this is usually 'default'; unless you are using a more complex attributes structure with various products)
Google Product Category: SELECT THE CATEGORY WE ADDED IN GoogleShopping/Helper/Category.php

Click "Save Mapping"

NOTE: if you already have an existing google attribute mapping, then select to edit it, and change 'Google Product Category' to the new category you added in GoogleShopping/Helper/Category.php. In the above example we would select 'Vehicles & Parts > Vehicle Parts & Accessories > Motor Vehicle Care'

Now... if this is a new mapping, continue below... otherwise we're done, you can now submit your content to google as usual.

This is how we map the google base attributes in magento:

a. Click 'Add New Attribute' (you may as well click this 8 times)
b. now for each one we created we will map as follows:
Manufacturer --> Brand
Name --> Title
Description --> Description
Special Price --> Sales Price
SKU --> Manufacturer's Part Number (MPN)
Condition --> Condition (this is a new field we need to create; see below)
UPC --> GTIN (this is a new field we need to create; see below)
Price --> Price
c. click 'Save Mapping'

Google specific attribute notes:

The following attributes need to be created, and applied to your attribute sets:

(I'm getting lazy at this point, so I'm hoping you know how to create attributes and place them in your attribute sets)

Go here:
Catalog --> Attributes --> Manage Attributes

Click 'Add new attribute'
Attribute Code: upc
Scope: Global
Catalog Input Type for Store: Text Field
Unique Value: yes
Values Required: no
Input Validation for Store Owner: none
Apply to: All Product Types
Frontend Properties: SELECT 'No' for everything else...
Manage Label / Options --> Manage Titles --> Admin: UPC
Click 'save attribute'

now we repeat... but do a select field instead...

Click 'Add new attribute'
Attribute Code: condition
Scope: Global
Catalog Input Type for Store: Dropdown
Unique Value: no
Values Required: yes
Input Validation for Store Owner: none
Apply to: All Product Types
Frontend Properties: SELECT 'No' for everything else...
Manage Label / Options --> Manage Titles --> Admin: Condition
Manage Options --> Admin:

  • new (position 1; Is Default)
  • refurbished (position 2)
  • used (position 3)

Click 'save attribute'

Now, you need to click and drag these new attributes into all your attribute sets...
Catalog --> Attributes --> Manage Attributes Sets

And finally, you need to fill in all the required google attributes under each product...

You best make sure you get the UPC correct, or you'll get flagged--i.e. if you're in the US, it has to be 12 numeric digits.

Here is a full list of google required attributes Take close note of the Unique Product Identifiers

Troubleshooting

When submitting products to google, via magento, and your Magento 1.7.x freezes (or gets stuck) at "Google Shopping synchronization process is running"

Go into phpMyAdmin, and run this query (under the "SQL" tab)

update core_flag set state='0' where flag_code='googleshopping';

That should clear it up.

Tags: magento google