A few weeks ago I shared some code to help with the hassle of importing Google Product Taxonomy into your Magento site to use on each product.
You can view the code here.
Unfortunately I wasn’t very clear on how to use this code, especially for beginners so I thought it would be more helpful to share a simple step-by-step guide.
Step 1 – Create the new Attribute
Create a new attribute in Magento admin by clicking on manage attributes-
Then click the “Add Attribute” button on the top right of the screen –
Add the attribute code of “google_taxonomy” and follow the rest of the settings like in the screenshots below.
Click on “Manage Label/Options” link in the top left -
And fill in the label you want in the Admin box –
Leave the “Manage Options” blank, this is what the script will populate for you.
Step 2 – Assign The Attribute to All Attribute Sets
I assume you want to add as many products as possible to the feed, in which case you need to add the attribute to all the attributes set so the new attribute can be applied to all products.
Go to Manage Attribute Sets and click on the set you wish to add the new attribute to. On the right had side you will see a list of all attributes that are not in the set, find google_taxonomy and drag it into the set choosing any group you wish, I just dropped it into the General group.
Hit Save Attribute Set.
Step 3 – Upload file and Prepare
If you haven’t already done so you can download it here.
Extract the content to the find two files inside. One file is the PHP script and the other is the taxonomy.en-GB.txt file, which can be downloaded from Google Merchant Center.
If you are outside the UK you will probably want to grab the version that suits your needs. Open up google_attr.php and scroll down line 111 and make sure the file name matches the one you have downloaded from Google (if different from the one already set)
Upload the two files to the web root of your site.
Step 4 - Run
You can either open your web browser and point it to http://www.yoursite.com/google_attr.php and let the script run however I prefer to do this from command line as the script will give you real time feedback of each item it adds giving you a better indication of how long it will take.
Please note that there are apporx 4500 entries in the taxonomy.en-GB.txt file which will take quite some time to run. If you import all 4500 entries it will be incredibly slow to edit them in the CMS. I advise to only import the categories that that are relevant to your catalogue.
Once the script finishes running you can then edit any product and the dropdown list of Google Taxonomy will be available in the Attribute Group you selected (General for me) :)