0

我有每个电子邮件地址的推荐产品 (4) 表 (Product_Recommendations)。

<style type="text/css">
.tg  {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg .tg-0lax{text-align:left;vertical-align:top}
</style>
<table class="tg">
  <tr>
    <th class="tg-0lax">EmailAddress</th>
    <th class="tg-0lax">Product_Name_1</th>
    <th class="tg-0lax">Product_Image_1</th>
    <th class="tg-0lax">Product_URL_1</th>
    <th class="tg-0lax">Product_Name_2</th>
    <th class="tg-0lax">Product_Image_2</th>
    <th class="tg-0lax">Product_URL_2</th>
    <th class="tg-0lax">Product_Name_3</th>
    <th class="tg-0lax">Product_Image_3</th>
    <th class="tg-0lax">Product_URL_3</th>
    <th class="tg-0lax">Product_Name_4</th>
    <th class="tg-0lax">Product_Image_4</th>
    <th class="tg-0lax">Product_URL_4</th>
  </tr>
  <tr>
    <td class="tg-0lax">test1@gmail.com</td>
    <td class="tg-0lax">Banana Chips</td>
    <td class="tg-0lax">https://images-na.ssl-images-amazon.com/images/I/81U4W10VayL._SY679_.jpg</td>
    <td class="tg-0lax">https://www.amazon.com/dp/B079VYSKDL/</td>
    <td class="tg-0lax">Rice Krispie Squares</td>
    <td class="tg-0lax">http://images.kglobalservices.com/www.ricekrispies.ca_en/en_ca/recipe/kicrecipe-23578/kicfileasset-122362__0048_original_vanilla.jpg</td>
    <td class="tg-0lax">http://www.ricekrispies.ca/en_CA/recipes/original-rice-krispie-squares-with-vanilla-rice-krispies-recipe.html</td>
    <td class="tg-0lax">Peanut Butter</td>
    <td class="tg-0lax">https://ll-us-i5.wal.co/asr/c8947428-64a5-4fc8-b8a6-f39e99f4e8ff_1.be53020d2e3a614597a2e922384cbe0b.jpeg-65dd04924f94d1da234876f07ed26ed101838351-optim-450x450.jpg?odnBg=FFFFFF</td>
    <td class="tg-0lax">https://www.amazon.com/Skippy-Creamy-Peanut-Butter-Ounce/dp/B0005ZH4QI</td>
    <td class="tg-0lax">Gatorade</td>
    <td class="tg-0lax">https://images-na.ssl-images-amazon.com/images/I/71tpcOn5JoL._SY679_.jpg</td>
    <td class="tg-0lax">https://www.amazon.com/Gatorade-Thirst-Quencher-Glacier-Freeze/dp/B000R32OOU/ref=pd_sim_325_5?_encoding=UTF8&amp;pd_rd_i=B000R32OOU&amp;pd_rd_r=559a5bc6-c1b9-11e8-a3f5-a953cb310f5f&amp;pd_rd_w=fWcKC&amp;pd_rd_wg=yJcCm&amp;pf_rd_i=desktop-dp-sims&amp;pf_rd_m=ATVPDKIKX0DER&amp;pf_rd_p=18bb0b78-4200-49b9-ac91-f141d61a1780&amp;pf_rd_r=2Z91KVV5TEG2Q2ZQ4570&amp;pf_rd_s=desktop-dp-sims&amp;pf_rd_t=40701&amp;psc=1&amp;refRID=2Z91KVV5TEG2Q2ZQ4570</td>
  </tr>
  <tr>
    <td class="tg-0lax">test2@gmail.com</td>
    <td class="tg-0lax">Applesauce</td>
    <td class="tg-0lax">https://images-na.ssl-images-amazon.com/images/I/811TRgBN2gL._SX522_.jpg</td>
    <td class="tg-0lax">https://www.amazon.com/dp/B073JGKQB9?</td>
    <td class="tg-0lax">Pepsi</td>
    <td class="tg-0lax">https://images-na.ssl-images-amazon.com/images/I/81I8cacfOUL._SX522_.jpg</td>
    <td class="tg-0lax">https://www.amazon.com/dp/B00NU5ZZJI/ref=sspa_dk_detail_5?psc=1&amp;fpw=pantry</td>
    <td class="tg-0lax">Cashews</td>
    <td class="tg-0lax">https://images-na.ssl-images-amazon.com/images/I/51b00pIFJnL.jpg</td>
    <td class="tg-0lax">https://www.amazon.com/dp/B01H5GB8ZW/ref=sspa_dk_detail_5?psc=1&amp;fpw=pantry</td>
    <td class="tg-0lax">Cheerios</td>
    <td class="tg-0lax">https://images-na.ssl-images-amazon.com/images/I/91DlHO9Y69L._SY679_.jpg</td>
    <td class="tg-0lax">https://www.amazon.com/Cheerios-Naturally-Flavored-Sweetened-Cereal/dp/B07D3FFTH2/</td>
  </tr>
</table>

我想使用 ampscript 查找将这些产品添加到我的电子邮件中。我尝试了以下操作,但在 Marketing Cloud 中出错:

%%[ 
VAR @emailAddr, @p1_name, @p1_url, @p1_image
set @emailAddr = EmailAddress("emailaddr")
SET @p1_name = (Lookup("Product_Recommendation", "Product_Name_1" EmailAddress",@emailaddr))
SET @p1_url = (Lookup("Product_Recommendation", "Product_URL_1" EmailAddress",@emailaddr))
SET @p1_image = (Lookup("Product_Recommendation", "Product_Image_1" EmailAddress",@emailaddr)) 
]%%

不知道我做错了什么。谢谢!

4

1 回答 1

0

应该是这样的:

%%[ 

VAR @emailAddr, @p1_name, @p1_url, @p1_image
set @emailAddr = AttributeValue("emailaddr")

SET @p1_name = Lookup("Product_Recommendation", "Product_Name_1", "EmailAddress", @emailaddr)
SET @p1_url = Lookup("Product_Recommendation", "Product_URL_1", "EmailAddress", @emailaddr)
SET @p1_image = Lookup("Product_Recommendation", "Product_Image_1", "EmailAddress", @emailaddr)

]%%

您在查找函数中缺少逗号和双引号。

如果您正在寻找更多 AMPscript 查找示例,我的博客上有一堆

参考

于 2018-09-27T22:29:23.293 回答