XML Feed for Google Merchant Centre

Jade Blair asked on August 16, 2018 10:36

I am trying to create an XML file, so our Google Merchant Centre products are automatically updated, but I can't get 'brand' or 'link' to populate. Can anyone help me identify the problem with my macros? Here's my code (I placed ** around the problem lines):

<item>
  <g:id>{% SKUName %}</g:id>
  <title>{% SKUName %}</title>
  <description>{% SKUShortDescription %}</description>
  **<link>{% GetSKUURL %}</link>**
  <g:price>{% SKUPrice %} GBP</g:price>
  <g:availability>in stock</g:availability>
  <g:image_link>http://185.26.149.74/webimages/{% SKUName %}</g:image_link>
  **<g:brand>{% GetManufacturer %}</g:brand>**
  <g:mpn>{% SKUName %}</g:mpn>

Correct Answer

Arun Kumar answered on August 16, 2018 12:43

Try this:

<item>
 <guid isPermaLink="false"><%# Eval("SKUGUID") %></guid>
 <title><%# EvalCDATA("SKUName") %></title>
 <description><%# EvalCDATA("SKUDescription") %></description>
 <pubDate><%# GetRSSDateTime(Eval("SKUCreated")) %></pubDate>
 <link><![CDATA[<%# GetAbsoluteUrl(GetProductUrlForFeed(Eval("SKUGUID"),Eval("SKUName"),Eval<int> 
   ("NodeSiteID")),Eval<int>("NodeSiteID")) %>]]></link>
 <brand><%# EvalCDATA("SKU.SKUManufacturer.ManufacturerDisplayName", true) %></brand>
</item>

You can check this post for reference

0 votesVote for this answer Unmark Correct answer

Recent Answers


Arun Kumar answered on August 16, 2018 11:48

Hi,

Have you tried this:

 <%# EvalText("SKU.SKUManufacturer.ManufacturerDisplayName", true) %>
 <%# GetAbsoluteUrl(GetDocumentUrl()) %>
0 votesVote for this answer Mark as a Correct answer

Jade Blair answered on August 16, 2018 12:13

Hi Arun,

Thanks for the reply. Unfortunately it didn't work. The first one returned nothing and the second returned the URL for the XML file, rather than the product URL.

0 votesVote for this answer Mark as a Correct answer

Arun Kumar answered on August 16, 2018 12:22

Where are you calling this? Inside transformations or inside any web part or what is the data source of this?

0 votesVote for this answer Mark as a Correct answer

Jade Blair answered on August 16, 2018 12:29

It's a transformation in a Products RSS Feed web part

0 votesVote for this answer Mark as a Correct answer

Jade Blair answered on August 16, 2018 13:14 (last edited on August 16, 2018 13:15)

Thanks Arun, I had to modify it slightly but your answer got me there. Thank-you!

<item> 
<guid isPermaLink="false"><%# Eval("SKUGUID") %></guid>
<g:id><%# Eval("SKUName") %></g:id>
<title><%# Eval("SKUName") %></title>
<g:description><%# Eval("SKUShortDescription") %></g:description> 
<g:link><%# GetAbsoluteUrl(GetProductUrlForFeed(Eval("SKUGUID"),Eval("SKUName"),Eval<int>("NodeSiteID")),Eval<int>("NodeSiteID")) %></g:link> 
<g:image_link>http://185.26.149.74/webimages/<%# Eval("SKUName") %>.png</g:image_link> 
<g:availability>in stock</g:availability> 
<g:price><%# Eval("SKUPrice") %> GBP</g:price> 
<g:brand><%# Eval("SKU.SKUManufacturer.ManufacturerDisplayName", true) %></g:brand> 
<g:mpn><%# Eval("SKUName") %></g:mpn>
</item>
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.