Getting categories from the Google product Taxonomy

If you’re planning to categorise your products for the Google Merchant Centre ( you will need to determine a product category.

Google provides pages such as or

I’ve created a widget that enables you to select a category (in various languages) and copies it to a specified input field. Well when I say created I’ve stolen heavily:

It’s based on jquery-option-tree ( and work done by “topmonkey” ( and it includes the fix at (

The widget code is attached and to use it

  1. Enable the widget actions in the controller where it will be used

public function actions() {

   return array(


      'taxonomy.' => 'application.widgets.gTaxonomy',




  1. Add something similar to this into your view

<input type="text" id="dummyField" size="120" readonly="readonly"/>


$this->widget('application.widgets.gTaxonomy', array(

    'lang'             => 'en-GB',

    'updatableFieldId' => 'dummyField',

    'dialogTitle'      => 'Select Google product taxonomy (EN)',



<input type="text" id="dummyField2" size="120" readonly="readonly"/>


$this->widget('application.widgets.gTaxonomy', array(

    'lang'             => 'es-ES',

    'updatableFieldId' => 'dummyField2',

    'dialogTitle'      => 'Select Google product taxonomy (ES)',



I know that the language codes of en-GB, es-ES, nl-NL and en-US work.

It’s very rough and ready and it’s the first thing like this that I’ve tried to contribute and thought it might provide a starting point for someone else.

The known flaws are

  • The taxonomy files are read from Google each time (see getSubTree class) - they could be cached to improve performance.

  • When the dialog box opens it just has the last selections made and not selections based on a current value.

  • Documentation is lacking

  • Styling could be improved

  • There is no internationalisation

  • could be cached rather than read from Google each time and it lacks something in documentation.

  • It would probably be better as an input widget so it can be used more easily with models

Very useful. Thanks.