November Happy Hour will be moved to Thursday December 5th.

Dan Matthews
Jul 27, 2017
  2289
(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
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog