Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Dan Matthews
Jul 27, 2017
  2187
(1 votes)

Vulcan + Epi Commerce + Google Merchant = Happy

I recently had to get to grips with the Google Product Feed on an Episerver Commerce site. This potentially requires some fairly heavy lifting. This is probably why the awesome dudes over at Geta made a nice product feed tool that uses the Dynamic Data Store as a sort of cache. It’s probably a great tool, but I couldn’t get it working and it didn’t do quite what I wanted. I could have persisted, but I actually had a great opportunity in that the site I was working on was already using Vulcan, the lightweight ElasticSearch client for Episerver. With Vulcan, we can make the most of the high-performance search to do much of the heavy lifting, like the price handling. Because this code could be useful to others, I decided to make my product feed / Vulcan implementation generic, open source and on the Episerver Nuget feed. To install it, simply find it on nuget as TcbInternetSolutions.Vulcan.Commerce.GoogleProductFeed.

Once installed, you can hit the default product feed straight away. Simply go to http://yoursite.com/GoogleProductFeed/Default. This is the default feed, which for some territories may be enough. However, you may well want to specify additional properties to be included. For example, you may want to set a GTIN on your Variants and have that included. To configure that, create an InitializationModule and create a feed in the Initialize method. For example:

            var feed = ServiceLocator.Current.GetInstance<IGoogleProductFeedService>().CreateFeed<SiteVariationBase>("MyFeed");

            feed.BrandSelector = p => p.Brand;
            feed.DescriptionSelector = p => p.ShortDescription;
            feed.GTINSelector = p => p.GTIN;

This will create a feed at http://yoursite.com/GoogleProductFeed/MyFeed and will use the specified properties from your Variant type in the appropriate fields. f you don’t have the properties, then add them to whatever your base class for Variants is. You can also specify the Query to be passed through to Vulcan if you want by setting the Query property on the feed – this could do things like filter out certain products, or maybe you could create multiple feeds for different product categories. The URL for the feed is also very powerful, and uses the following segments:

GoogleProductFeed/[YOUR FEED NAME]/{market}/{language}/{currency}

If you skip the additional parameters, it will use the default market, language and currency. If you specify them, use short names, such as:

GoogleProductFeed/MyFeed/SouthAfrica/en-za/zar

With this technique, you can register multiple product feeds in your Google Merchant Centre for your different territories. Note that some territories have mandatory requirements on shipping, brand etc. Make sure that your feeds are correctly configured!

DISCLAIMER: This project is in no way connected with or endorsed by Episerver. It is being created under the auspices of a South African company and is entirely separate to what I do as an Episerver employee.

Jul 27, 2017

Comments

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog