# Feed模板数据字典

## 一、数据字典 <a href="#yi-shu-ju-zi-dian" id="yi-shu-ju-zi-dian"></a>

### 1.字典结构JSON <a href="#id-1-zi-dian-jie-gou-json" id="id-1-zi-dian-jie-gou-json"></a>

```
{
    productList:[
        product:{
            productId:"产品ID",
            title；"产品标题",
            ...
            variants:[
                variant:{
                    feedId:"变体GID",
                    ...
                }
            ],
            firstVariant:{
                feedId:"",
                    ...
            }
            images:[
                image:{
                    src:"图片路径",
                    alt:"ALT文字",
                    width:"宽度",	
                    height:"高度"	
                }
            ],
            featuredImage;{
                src:"图片路径",
                alt:"ALT文字",
                width:"宽度",	
                height:"高度"
            }
            ...
        }
    ],
    storeConfig:{
        id:"店铺ID",
        number:"店铺序号",
        symbol:"唯一标识",
        currency:"货币类型",
        currencyRate:"货币小数位",
        locales:"语言环境"
    },
    domain:{
        host:"域名"
    }
}
```

### productList ：产品数组

<table><thead><tr><th width="168.33333333333331">标题</th><th width="120">类型</th><th>说明</th></tr></thead><tbody><tr><td>productId</td><td>string</td><td>产品ID</td></tr><tr><td>title</td><td>string</td><td>产品标题（优先取feed组中的产品自定义标题，如果为空取产品seo标题）</td></tr><tr><td>description</td><td>string</td><td>产品描述（优先取eed组中的产品自定义描述，如果为空取产品seo描述）</td></tr><tr><td>imageVOList</td><td>array</td><td>图片对象数组</td></tr><tr><td>featuredImage</td><td>object</td><td>产品首图对象</td></tr><tr><td>imageLink</td><td>string</td><td>优先获取feed组中自定义的图片路径，如果未设置取产品首图图片路径</td></tr><tr><td>additionalImageLink</td><td>string</td><td>产品图片路径（除首图外最多10张图，多个路径用逗号分隔）</td></tr><tr><td>images</td><td>array</td><td>产品图片路径数组（除首图外最多10张图）</td></tr><tr><td>quantity</td><td>int</td><td>库存（优先取feed组中自定义库存值，如果为空计算产品下所以变体总库存数量求和）</td></tr><tr><td>availability</td><td>string</td><td>优先取feed组中自定义availability，如果未定义则根据库存数来填充，库存数>0: in_stock;反之out_of_stock</td></tr><tr><td>condition</td><td>string</td><td>优先取feed组中自定义condition，未定义默认new</td></tr><tr><td>variants</td><td>array</td><td>变体对象数组</td></tr><tr><td>firstVariant</td><td>object</td><td>首个变体对象</td></tr><tr><td>compareAtPrice</td><td>string</td><td>LP产品首个变体市场价</td></tr><tr><td>compareAtPriceMax</td><td>string</td><td>LP产品变体最高市场价</td></tr><tr><td>compareAtPriceMin</td><td>string</td><td>LP产品变体最低市场价</td></tr><tr><td>price</td><td>string</td><td>产品销售价，优先取feed组中的自定义的价格，如未定义取产品下首个变体的销售价</td></tr><tr><td>priceMax</td><td>string</td><td>LP产品变体最高销售价</td></tr><tr><td>priceMin</td><td>string</td><td>LP产品变体最低销售价</td></tr><tr><td>gtin</td><td>string</td><td>gtin需在feed组中自定义，如未定义取LP产品下首个变体的brcode</td></tr><tr><td>brand</td><td>string</td><td>brand需在feed组中自定义，如未定义取LP产品vendor</td></tr><tr><td>mpn</td><td>string</td><td>mpn需在feed组中自定义</td></tr><tr><td>googleProductCategory</td><td>string</td><td>googleProductCategory需在feed组中自定义</td></tr><tr><td>googleProductType</td><td>string</td><td>googleProductType需在feed组中自定义</td></tr><tr><td>gender</td><td>string</td><td>gender需在feed组中自定义</td></tr><tr><td>ageGroup</td><td>string</td><td>ageGroup需在feed组中自定义</td></tr><tr><td>color</td><td>string</td><td>color需在feed组中自定义</td></tr><tr><td>link</td><td>string</td><td>产品link（已废弃，但仍然兼容，用handle代替）</td></tr><tr><td>feedId</td><td>string</td><td>GID优先取feed组中的自定义的GID，未定义取LP产品ID</td></tr><tr><td>itemGroupId</td><td>string</td><td>itemGroupId需在feed组中自定义</td></tr><tr><td>size</td><td>string</td><td>size需在feed组中自定义</td></tr><tr><td>shippingWeight</td><td>string</td><td>shippingWeight需在feed组中自定义</td></tr><tr><td>adWordsGrouping</td><td>string</td><td>adWordsGrouping需在feed组中自定义</td></tr><tr><td>adWordsLabels</td><td>string</td><td>adWordsLabels需在feed组中自定义</td></tr><tr><td>customProduct</td><td>string</td><td>customProduct需在feed组中自定义</td></tr><tr><td>collections</td><td>array</td><td>集合对象数组</td></tr><tr><td>collectionIds</td><td>string</td><td>产品所在集合IDS（多个集合ID逗号分隔）</td></tr><tr><td>tags</td><td>string</td><td>产品标签（多个标签逗号分隔）</td></tr><tr><td>productType</td><td>string</td><td>LP产品类型</td></tr><tr><td>vendor</td><td>string</td><td>LP产品品牌(供应商)</td></tr><tr><td>seoTitle</td><td>string</td><td>LP产品seo标题</td></tr><tr><td>seoDescription</td><td>string</td><td>LP产品seo描述</td></tr><tr><td>seoKeywords</td><td>string</td><td>LP产品seo关键词</td></tr><tr><td>productTitle</td><td>string</td><td>LP产品标题</td></tr><tr><td>bodyHtml</td><td>string</td><td>LP产品html描述</td></tr><tr><td>handle</td><td>string</td><td>LP产品句柄handle</td></tr></tbody></table>

### featuredImage:图片对象

| 标题     | 类型      | 说明    |
| ------ | ------- | ----- |
| src    | string  | src   |
| alt    | string  | ALT文字 |
| width  | Integer | 宽度    |
| height | Integer | 高度    |

### imageVOList:图片对象数组

| 标题     | 类型      | 说明    |
| ------ | ------- | ----- |
| src    | string  | src   |
| alt    | string  | ALT文字 |
| width  | Integer | 宽度    |
| height | Integer | 高度    |

### variants:变体对象数组

<table><thead><tr><th width="247.33333333333331">标题</th><th width="126">类型</th><th>说明</th></tr></thead><tbody><tr><td>title</td><td>string</td><td>feed组中自定义title</td></tr><tr><td>description</td><td>string</td><td>feed组中自定义description</td></tr><tr><td>quantity</td><td>Integer</td><td>feed组中自定义库存，如未定义取变体对应库存</td></tr><tr><td>condition</td><td>string</td><td>feed组中自定义condition</td></tr><tr><td>availability</td><td>string</td><td>feed组中自定义availability</td></tr><tr><td>price</td><td>string</td><td>feed组中自定义price</td></tr><tr><td>gtin</td><td>string</td><td>feed组中自定义gtin</td></tr><tr><td>brand</td><td>string</td><td>feed组中自定义brand</td></tr><tr><td>mpn</td><td>string</td><td>feed组中自定义mpn</td></tr><tr><td>googleProductCategory</td><td>string</td><td>feed组中自定义googleProductCategory</td></tr><tr><td>googleProductType</td><td>string</td><td>feed组中自定义googleProductType</td></tr><tr><td>gender</td><td>string</td><td>feed组中自定义gender</td></tr><tr><td>ageGroup</td><td>string</td><td>feed组中自定义ageGroup</td></tr><tr><td>color</td><td>string</td><td>feed组中自定义color</td></tr><tr><td>feedId</td><td>string</td><td>feed组中自定义GID</td></tr><tr><td>customLabel0</td><td>string</td><td>feed组中自定义customLabel0</td></tr><tr><td>customLabel1</td><td>string</td><td>feed组中自定义customLabel1</td></tr><tr><td>customLabel2</td><td>string</td><td>feed组中自定义customLabel2</td></tr><tr><td>customLabel3</td><td>string</td><td>feed组中自定义customLabel3</td></tr><tr><td>customLabel4</td><td>string</td><td>feed组中自定义customLabel4</td></tr><tr><td>itemGroupId</td><td>string</td><td>feed组中自定义itemGroupId</td></tr><tr><td>size</td><td>string</td><td>feed组中自定义size</td></tr><tr><td>shippingWeight</td><td>string</td><td>feed组中自定义shippingWeight</td></tr><tr><td>adWordsGrouping</td><td>string</td><td>feed组中自定义adWordsGrouping</td></tr><tr><td>adWordsLabels</td><td>string</td><td>feed组中自定义adWordsLabels</td></tr><tr><td>customProduct</td><td>string</td><td>feed组中自定义customProduct</td></tr><tr><td>featuredImage</td><td>object</td><td>变体图片对象</td></tr><tr><td>variantId</td><td>string</td><td>LP变体ID</td></tr><tr><td>sku</td><td>string</td><td>sku</td></tr><tr><td>barcode</td><td>string</td><td>barcode条码</td></tr><tr><td>levyTariff</td><td>Boolean</td><td>是否征收关税</td></tr><tr><td>tariffCode</td><td>string</td><td>HS关税代码</td></tr><tr><td>originalPrice</td><td>string</td><td>市场价</td></tr><tr><td>sellingPrice</td><td>string</td><td>销售价</td></tr><tr><td>weight</td><td>string</td><td>重量</td></tr><tr><td>weightUnit</td><td>string</td><td>重量单位</td></tr><tr><td>allowTrackInventory</td><td>boolean</td><td>允许跟踪库存</td></tr><tr><td>outOfStockBehavior</td><td>string</td><td>缺货时行为：sell继续销售，off下架</td></tr><tr><td>position</td><td>string</td><td>position</td></tr><tr><td>option1Name</td><td>string</td><td>option1Name</td></tr><tr><td>option1Value</td><td>string</td><td>option1Value</td></tr><tr><td>option2Name</td><td>string</td><td>option2Name</td></tr><tr><td>option2Value</td><td>string</td><td>option2Value</td></tr><tr><td>option3Name</td><td>string</td><td>option3Name</td></tr><tr><td>option3Value</td><td>string</td><td>option3Value</td></tr><tr><td>option4Name</td><td>string</td><td>option4Name</td></tr><tr><td>option4Value</td><td>string</td><td>option4Value</td></tr><tr><td>option5Name</td><td>string</td><td>option5Name</td></tr><tr><td>option5Value</td><td>string</td><td>option5Value</td></tr><tr><td>requiresShipping</td><td>Boolean</td><td>是否需要运输</td></tr><tr><td>saleNum</td><td>string</td><td>销量</td></tr></tbody></table>

### collections:集合对象数组

| 标题       | 类型      | 说明          |
| -------- | ------- | ----------- |
| title    | string  | 集合名称        |
| handle   | string  | handle      |
| id       | string  | 集合id        |
| position | Integer | 排序位置        |
| type     | string  | 集合类型(manual |

### storeConfig：店铺配置

| 标题           | 类型     | 说明    |
| ------------ | ------ | ----- |
| id           | string | 店铺ID  |
| number       | int    | 店铺序号  |
| symbol       | string | 唯一标识  |
| currency     | string | 货币类型  |
| currencyRate | int    | 货币小数位 |
| locales      | string | 语言环境  |

### domain：域名等信息

| 标题   | 类型     | 说明 |
| ---- | ------ | -- |
| host | string | 域名 |

## 二、模板例子： <a href="#er-mo-ban-li-zi" id="er-mo-ban-li-zi"></a>

### 1.取值语法

### &#x20;1.1 product维度取值freemarker模板引擎语法

```xml
<#if productList?? && (productList?size > 0) >         
    <#list productList as product>        
        <item>
            <productId>${product.productId!''}</productId>
        </item>
    </#list>        
</#if> 
```

### 1.2 变体维度取值freemarker模板引擎语法 <a href="#id-12-bian-ti-wei-du-qu-zhi-freemarker-mo-ban-yin-qing-yu-fa" id="id-12-bian-ti-wei-du-qu-zhi-freemarker-mo-ban-yin-qing-yu-fa"></a>

```
<#if productList?? && (productList?size > 0) >         
    <#list productList as product>        
        <#if product.variants?? && (product.variants?size > 0) > 
            <#list product.variants as variant> 
                <item>
                    <variantId>${variant.variantId!''} </variantId>
                </item>
            </#list>        
        </#if> 
    </#list>        
</#if> 
```

### 2.LAZYSHOP soufeel  US站模板示例 <a href="#id-2lazyshopsoufeelus-zhan-mo-ban-shi-li" id="id-2lazyshopsoufeelus-zhan-mo-ban-shi-li"></a>

#### US默认产品-freemark <a href="#us-mo-ren-chan-pin-freemark" id="us-mo-ren-chan-pin-freemark"></a>

```
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
    <channel>
        <title> </title>
        <description> </description>
        <link> </link>
        <#if productList?? && (productList?size > 0) >         
            <#list productList as product>        
               <item>
                    <g:id>${product.feedId!''}</g:id>
                    <g:title> ${product.title?replace("&","&amp;")}</g:title>
                    <g:description>${(product.description?replace("&","&amp;"))!''}</g:description>
                    <g:mpn>${product.mpn!''}</g:mpn>
                    <g:link>https://soufeel.com/products/${product.link!''}</g:link>
                    <g:mobile_link>https://soufeel.com/products/${product.link!''}</g:mobile_link>
                    <g:image_link>${product.imageLink!''}</g:image_link>
                    <g:condition>new</g:condition>
                    <g:availability>in stock</g:availability>
                    <g:price>${product.price!''} ${storeConfig.currency!''}</g:price>
                    <g:brand>Soufeel</g:brand>                                                                     
                    <g:google_product_category>${product.googleProductCategory!''}</g:google_product_category>            
                    <g:product_type><#if product.googleProductType?? >${product.googleProductType?replace("&","&amp;")!' '}</#if></g:product_type>
                    <g:gender>${product.gender!' '}</g:gender>
                    <g:color>Multicolor</g:color>
                    <g:size>${product.size!' '}</g:size>
                    <g:age_group>adult</g:age_group>
                    <g:custom_label_0>${product.custom_label_0!' '}</g:custom_label_0>
                    <g:custom_label_4>${product.custom_label_4!' '}</g:custom_label_4>
                    <g:shipping>
                        <g:country>us</g:country>
                    </g:shipping>
                    <g:content_id>${product.productId!''}</g:content_id>
                </item>
            </#list>        
        </#if>    
    </channel>
</rss>
```

#### US 变体模板-freemark <a href="#us-bian-ti-mo-ban-freemark" id="us-bian-ti-mo-ban-freemark"></a>

```
<?xml version="1.0"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title></title>
<link></link>
<description></description>
<#if productList?? && (productList?size > 0) >         
    <#list productList as product>        
        <#if product.variants?? && (product.variants?size > 0) > 
            <#list product.variants as variant> 
                <item>
                    <g:id><#if variant.feedId?? >${variant.feedId}<#else>${product.productId}_${variant.variantId}_${variant.sku!''}</#if></g:id>
                    <g:title>${(product.title?replace('&','&amp;'))!''}</g:title>
                    <g:condition>${variant.condition!''}</g:condition>
                    <g:description>${(product.description?replace('&','&amp;'))!''}</g:description>
                    <g:mpn>${variant.mpn!''}</g:mpn>
                    <g:link>https://${domain.host!''}/products/${product.handle!''}?variant=${variant.variantId!''}</g:link>
		    <g:mobile_link>https://${domain.host!''}/products/${product.handle!''}?variant=${variant.variantId!''}</g:mobile_link>
                    <g:image_link>${product.imageLink!''}</g:image_link>
                    <g:condition>${variant.condition!''}</g:condition>
                    <g:availability>${variant.availability!''}</g:availability>
                    <g:price><#if product.firstVariant?? >${product.firstVariant.sellingPrice!''}</#if> ${storeConfig.currency!''}</g:price>
                    <g:brand>${variant.brand!''}</g:brand>
		    <g:google_product_category>${variant.googleProductCategory!''}</g:google_product_category>
                    <g:product_type>${(variant.googleProductType?replace('&','&amp;'))!''}</g:product_type>
                    <g:gender>${variant.gender!''}</g:gender>
                    <g:color>${variant.color!''}</g:color>
                    <g:age_group>${variant.ageGroup!''}</g:age_group>
                    <g:custom_label_0>${(variant.customLabel0?replace('&','&amp;'))!''}</g:custom_label_0>
                    <g:custom_label_4>${(variant.customLabel4?replace('&','&amp;'))!''}</g:custom_label_4>
                    <g:shipping>
                        <g:country>us</g:country>
                    </g:shipping>
                    <g:content_id>${product.productId!''}</g:content_id>
                </item>
            </#list>        
        </#if> 
    </#list>        
</#if>      
</channel>
</rss>
```

#### US 变体模板-liquid <a href="#us-bian-ti-mo-ban-liquid" id="us-bian-ti-mo-ban-liquid"></a>

```
<?xml version="1.0"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title></title>
<link></link>
<description></description>
{% for product in productList %}
  {% for variant in product.variants %}
	<item>
           <g:id>{% if variant.feedId != null and variant.feedId != '' %}{{variant.feedId}}{% else %}{{product.productId}}_{{variant.variantId}}_{{variant.sku}}{% endif %}</g:id>
	   <g:title>{{product.title | replace:'&','&amp;'}}</g:title>
	   <g:condition>{{variant.condition}}</g:condition>
	   <g:description>{{product.description | replace:'&','&amp;'}}</g:description>
	   <g:mpn>{{variant.mpn}}</g:mpn>
	   <g:link>https://{{domain.host}}/products/{{product.handle}}?variant={{variant.variantId}}</g:link>
	   <g:mobile_link>https://{{domain.host}}/products/{{product.handle}}?variant={{variant.variantId}}</g:mobile_link>
	   <g:image_link>{{product.imageLink}}</g:image_link>
	   <g:condition>{{variant.condition}}</g:condition>
	   <g:availability>{{variant.availability}}</g:availability>
	   <g:price>{{product.firstVariant.sellingPrice}} {{storeConfig.currency}}</g:price>
	   <g:brand>{{variant.brand}}</g:brand>
	   <g:google_product_category>{{variant.googleProductCategory}}</g:google_product_category>
	   <g:product_type>{{variant.googleProductType | replace:'&','&amp;'}}</g:product_type>
	   <g:gender>{{variant.gender}}</g:gender>
	   <g:age_group>{{variant.ageGroup}}</g:age_group>
	   <g:custom_label_0>{{variant.customLabel0 | replace: '&','&amp;'}}</g:custom_label_0>
	   <g:custom_label_4>{{variant.customLabel4 | replace: '&','&amp;'}}</g:custom_label_4>
	   <g:shipping>
               <g:country>us</g:country>
           </g:shipping>
	   <g:content_id>{{product.productId}}</g:content_id>
   </item>
  {% endfor %}  
{% endfor %}  
</channel>
</rss>
```

#### US第三方推荐-freemark <a href="#us-di-san-fang-tui-jian-freemark" id="us-di-san-fang-tui-jian-freemark"></a>

```
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
    <channel>
        <title> </title>
        <description> </description>
        <link> </link>
        <#if productList?? && (productList?size > 0) >         
            <#list productList as product>        
            <item>
                <g:id>${product.productId}-${product.firstVariant.sku}</g:id>
                <g:sku>${product.firstVariant.sku}</g:sku>
                <g:product_id>${product.productId}</g:product_id>
                <g:product_handle>${product.link!' '}</g:product_handle>
                <g:title>${product.title?replace("&","&amp;")}</g:title>
                <g:type><#if product.productType?? >${product.productType?replace("&","&amp;")}</#if></g:type>
                <g:collection_id>${product.collectionIds!''}</g:collection_id>
                <g:condition>new</g:condition>
                <g:identifier_exists>no</g:identifier_exists>
                <g:description><#if product.description?? >${product.description?replace("&","&amp;")}</#if></g:description>
                <g:link>https://soufeel.com/products/${product.link!''}</g:link>
                <g:mobile_link>https://soufeel.com/products/${product.link!''}</g:mobile_link>
                <g:image_link>${product.imageLink!''}</g:image_link>
                <g:image_thumbnail>${product.imageLink!''}</g:image_thumbnail>
                <g:condition>new</g:condition>
                <g:availability>in stock</g:availability>
                <g:sale_price>${product.firstVariant.originalPrice} ${storeConfig.currency!''}</g:sale_price>
                <g:price>${product.firstVariant.sellingPrice} ${storeConfig.currency!''}</g:price>
                <g:brand>Soufeel</g:brand>
                <g:google_product_category>${product.googleProductCategory!' '}</g:google_product_category>
                <g:product_type><#if product.googleProductType?? >${product.googleProductType?replace("&","&amp;")}</#if></g:product_type>
                <g:gender>${product.gender!' '}</g:gender>
                <g:color>${product.color!' '}</g:color>
                <g:age_group>adult</g:age_group>
                <g:new>1</g:new>
                <g:onSale>1</g:onSale>
                 <g:packing><#if product.tags?? && product.tags?contains('CART_GIVEAWAY')>1<#else>0</#if></g:packing>
                <g:custom_label_0>${product.custom_label_0!' '}</g:custom_label_0>
                <g:shipping>
                    <g:country>us</g:country>
                </g:shipping>
            </item>
        </#list>        
      </#if>    
      </channel>
</rss>
```

#### US 搜索feed <a href="#us-sou-suo-feed" id="us-sou-suo-feed"></a>

```
<?xml version="1.0" encoding="UTF-8"?>
<products>
    <#if productList?? && (productList?size > 0) >         
        <#list productList as product> 
            <#if product.tags?? && product.tags?contains('hide-product')>
            <#else>
              <product>
                  <ID>${product.productId!''}</ID>
                  <masterID> </masterID>
                  <categoryTree> </categoryTree>
                  <name>${product.title?replace("&","&amp;")}</name>
                  <sku><#assign index = 0><#if product.variants?exists><#list product.variants as var><#if index != 0>|</#if>${var.sku?trim}<#assign index = index+1></#list></#if></sku>
                  <LargeImageUrl>${product.imageLink!''}</LargeImageUrl>
                  <ThumbnailImageUrl>${product.imageLink!''}</ThumbnailImageUrl>
                  <URL>${product.link!''}</URL>
                  <salePrice><#assign index = 0><#if product.variants?exists><#list product.variants as var><#if index != 0>|</#if>${var.sellingPrice?trim}<#assign index = index+1></#list></#if></salePrice>
                  <retailPrice><#assign index = 0><#if product.variants?exists><#list product.variants as var><#if index != 0>|</#if>${var.originalPrice?trim}<#assign index = index+1></#list></#if></retailPrice>
                  <salePriceCurrency><#assign index = 0><#if product.variants?exists><#list product.variants as var><#if index != 0>|</#if>$${var.sellingPrice?trim}<#assign index = index+1></#list></#if></salePriceCurrency>
                  <retailPriceCurrency><#assign index = 0><#if product.variants?exists><#list product.variants as var><#if index != 0>|</#if>$${var.originalPrice?trim}<#assign index = index+1></#list></#if></retailPriceCurrency>
                  <availability>instock</availability>
                  <gender> </gender>
                  <brand>SOUFEEL</brand>
                  <connectedProducts> </connectedProducts>
                  <new>1</new>
                  <onSale>1</onSale>
                  <recentPriceDrop> </recentPriceDrop>
                  <bestSelling>0</bestSelling>
                  <color>${product.color!' '}</color>
                  <material> </material>
                  <sale>${product.saleNum!0}</sale>
                  <packing>0</packing>
              </product>
          </#if>
       </#list>        
    </#if>  	
</products>
```
