Post by ogomo » Thu Sep 08, 2011 9:11 pm

On September 22, 2011 Google Merchant Center will require several items in product feeds, which were previously recommended but not required. I'm having a lot of difficulty implementing one of these, Google Product Category, which uses their own taxonomy.

Here's what Google has to say about it:
Google Product Category: We have added a new required high-level attribute called [google product category] that contains the category of the item in Google’s taxonomy (currently only required for a select number of categories). This is in addition to the current [product type] attribute.
I am using Opencart v 1.4.9.4 and Google Base Improved v1.4.8.

I originally misunderstood this and thought I could just add Google's categories to my existing list of categories, and set their sort order to -1 (to not display on the storefront). This unfortunately just adds these categories to the product_type attribute.

Has anyone figured out how to add google_product_category to their product feeds? I'm hoping there's a way to simply add categories with a sort order of -1 to the feed as the Google category.

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by ogomo » Fri Sep 09, 2011 2:25 am

So I think I'm half way there. In the file /catalog/controller/feed/google_base_improved.php, I copied the following code:

Code: Select all

                $categories = $this->model_catalog_product->getCategories($p['product_id']);

                foreach($categories as $c) {
    				$path = $this->getPath($c['category_id']);

    				if ($path) {
    				    $cats = array();

    					foreach (explode('_', $path) as $path_id) {
    						$category_info = $this->model_catalog_category->getCategory($path_id);
    						if ($category_info) $cats[] = $category_info['name'];
    					}
                        if(count($cats)) $item->appendChild($this->_c('g:product_type', implode(' > ', $cats), false));
    				}
                }
And duplicated it with one small change to the last "if" line:

Code: Select all

                $categories = $this->model_catalog_product->getCategories($p['product_id']);

				foreach($categories as $c) {
    				$path = $this->getPath($c['category_id']);

    				if ($path) {
    				    $cats = array();

    					foreach (explode('_', $path) as $path_id) {
    						$category_info = $this->model_catalog_category->getCategory($path_id);
    						if ($category_info) $cats[] = $category_info['name'];
    					}
                        if(count($cats)) $item->appendChild($this->_c('g:google_product_category', implode(' > ', $cats), false));
    				}
                }
Now my feed lists the product categories as both <g:product_type> and <g:google_product_category>.

Now what I need it to do is list only the categories that are visible in my storefront as the <g:product_type>, and the ones that aren't (i.e. the categories with sort order = -1) as <g:google_product_category>.

Any ideas??

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by Xsecrets » Fri Sep 09, 2011 2:28 am

well the correct way to do this is going to be to add a google taxonomy field to the database. Even then that only gets part of the problem. If you sell aparrel electronics or media I think those are the three then you have to add other attributes as well, and they all have to be listed on different lines, which is going to be a nightmare with opencarts structure, and impossible to do in a standard manner that works for all stores.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by uksitebuilder » Fri Sep 09, 2011 2:40 am

The biggest problem as mentioned by X is the variants (or OC product options)

I have overcome all requirements for sinlges item sellers but that with my extension at present, I will find a way to somehow tackle variants too, but it probably wont be for a week or 3

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by ogomo » Fri Sep 09, 2011 2:43 am

Well I've added the categories according to Google's taxonomy to my database, however those are set to sort order = -1 so they don't display in my store, but display on the product feed.

My store is located at http://www.ogomo.com and the feed is located at http://ogomo.com/index.php?route=feed/g ... e_improved

As you can see, the first item lists 6 <g:product_type> entries and 6 identical <g:google_product_category> entries.

The first two are the categories that show up in my storefront, and the remaining ones are correct according to Google's taxonomy. I just need to tell the feed to list <g:product_type> as all categories with the sort order being >=0 and list <g:google_product_category> as all categories with the sort order being = -1.

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by uksitebuilder » Fri Sep 09, 2011 2:52 am

Google only allows 1 google_product_category per product

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by ogomo » Fri Sep 09, 2011 3:01 am

Simon,
I just noticed the link to "Google merchant/base xml feed" in your signature. Two questions:
1 - Does this work with the US as the target country?
2 - Does it work with OC 1.4.9.4? (Pretty sure this is yes, but 2x checking)
If so, I'm sold...

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by uksitebuilder » Fri Sep 09, 2011 3:03 am

1- Yes all countries
2- 1.5.x is fully compliant )apart from variant products) 1.4.9.x Will be by Wednesday next week now that 1.5.x is out and feedback has been positive

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by ogomo » Fri Sep 09, 2011 3:20 am

Just set my calendar reminder to purchase this on Wednesday.

Thanks for your help!

New member

Posts

Joined
Thu Aug 04, 2011 1:35 am

Post by uksitebuilder » Thu Sep 15, 2011 4:59 am

1.4.9.x Version is now available.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by hbg » Mon Oct 10, 2011 10:38 am

I wish I discovered this earlier. It would have saved a great deal of headaches.

Opencart Version 1.5.1.3
https://www.opencart.homebrewinn.com.au/shop/


User avatar
hbg
Active Member

Posts

Joined
Wed Apr 13, 2011 8:52 am
Location - Newcastle NSW Australia

Post by sbproduction » Thu Oct 13, 2011 11:55 pm

Hi here is my product feed:
http://www.livelifesports.co.uk/index.p ... e_improved
right now google say that i need to add availbility. Is this simple or do i need to buy you add on simon? If i do will that answer my problems. I have two shops one runs on 1.4.9.3 and the other on 1.5 does that mean i will need to purchase twice?

New member

Posts

Joined
Mon Sep 05, 2011 5:29 am

Post by uksitebuilder » Tue Oct 18, 2011 7:29 pm

If you have 2 separate installations of OC, then yes, you should buy 2 separate licenses

This is the same for all OC Commercial extensions unless they specifically say otherwise

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom
Who is online

Users browsing this forum: No registered users and 1 guest