Try our conversational search powered by Generative AI!

Dan Matthews
Jul 27, 2017
  2209
(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 Search and Navigation - Part 2 - Filter Tips

Introduction Continuing from Part 1 – Search Tips , today I will share the next part – filter tips. The platform versions used for this article are...

Binh Nguyen Thi | Jul 1, 2024

Integrating HubSpot CRM without the MA Connector

Have HubSpot CRM? Want to push user data into it from Optimizely? Don’t have any personalisation requirements with that data? Don’t want to pay $80...

Matt Pallatt | Jun 27, 2024

Keeping the website secure by updating external packages

Did you see the latest warning from Optimizely to update this package with a critical security warning? https://world.optimizely.com/documentation/...

Daniel Ovaska | Jun 27, 2024

Optimizely CMS image anonymization now available for Linux!

The famous image anonymization add-on for Optimizely CMS, with at least 5 downloads, is now finally available for use on Linux. Supports simultaneo...

Tomas Hensrud Gulla | Jun 25, 2024 | Syndicated blog