OpenCart: Google Feed "Availability" Attribute

Updated April 3, 2012

This currently affects up to OpenCart 1.5.1.3.1; the availability attribute was added in 1.5.2.x (March 3rd, 2012 Release).

However, other issues, such as reporting all item conditions as "new" and Google Wallet not deducting inventory (which PrestaShop and Magento have been able to do for a while) still exist. However, it finally has IP Ban! Of course, if your web host provider has a tool to manage IPs, such as cPanel, it probably isn't a significant addition.


You'll notice that when creating (or trying to) a googlebase feed, this attribute is missing from all products; the reason isn't because of OpenCart (well, it is, sort of) but because Google never required the attribute before.

Now that it does, you can wait for a release of OpenCart to pass its availability attribute to its feed or manually insert it. Of course, if you have tons of products, this will be time consuming; if you need it done now, I hope you like copying and pasting shortcuts.

There are four possible attributes for availability: in stock, available for order, out of stock, and preorder as seen on Google here: https://support.google.com/merchants/answer/188494#US.

There's one other problem with OpenCart that doesn't seem to be widely discussed: the "condition" attribute. If you look at your feed as-it-is without modification, you might notice every single product has a "new" condition.

Since I was going to manually modify my product feed anyway, I changed this as well. This is only for those who want their feed to be absolutely consistent to reflect the condition of items they sell unless everything is, in fact, new.

A very fast and accurate method to check your condition and add availability in XML (because that's what the feed is in by default) is to use XML software (*gasp*!). Since I was in a rush, I found the first open source program that looked decent and it actually turned out to be just fine, minus one crash.

In short, download your feed and use a program such as Syntext Serna Free so it looks like a nice XML tree and easy to read. If you don't know where your feed is, go to Extensions > Product Feeds > Google Base and "edit" to find the URL (assuming it is enabled). If your browser won't let you download it or save the page, use another browser.

There isn't much to Syntext; you'll see all the attributes on the left which can be changed in the right pane. Your attributes are known as "elements" on the left and the content in the right pane is the "content." So where you see the "condition" attribute on the left, it is defined in the right pane as "new." That's all you really need to grasp to get through this. When you start the program, just elect to use the "default" template. There's no need to get fancy here.

Let's add the availability attribute. I'm going to presume your items are in stock for this tutorial. Since we're working in XML, the element you will insert into each product is <g:availability>in stock</g:availability>.

Using your secondary mouse button (usually right-clicking), on item, select Insert Element.

Example 1

Remember, it doesn't matter where any attribute appears. You can drag each element around if it is preferred they are in a certain order. Google, nor any feed, cares about where its position is, only that it exists.

Next, insert the g:availability attribute in the box. Keep "Close on insert" checked so that the tag will be automatically closed. Example 2

If you don't see the newly-added tag, right-click its element on the left and it will be highlighted on the right. Since this is a new tag, it will look like this:

Example 3
Start typing - you'll notice the element tag "disappear" (not really, it just depends where your mouse is focused).
Example 4

Annnnd - that's pretty much it! Copy and paste this attribute and apply it to all products. Remember, it doesn't matter where it goes, just as long as it's there. If you're a Windows user, CTRL P throughout the list and the process will be done before you know it.
Example 5

Don't forget to check your other tags, including condition and add google's own product category if you feel it's necessary. Search for your products using Google's Taxonomy at https://support.google.com/merchants/answer/160081?hl=en.

 

One other thing: should you decide to manually modify your feed, it will be necessary to update products' stock as necessary, too.