Hi,
I have a product listing payload from real time communication.
Below is the payload
{
"email":"myprofile@adobe.com",
"ctx":{
"TotalPrice":1234.123456789,
"OrderID":"string127",
"ProfileNumber":"phone",
"ProfileEmailId":"myprofile@adobe.com",
"ProfileName":"string127",
"Content":[
{
"BrandName":"string127 #1",
"BrandPrice":1234.123456789
},
{
"BrandName":"string127 #2",
"BrandPrice":1234.123456789
}
]
}
}
Trying to use Content Array into Content block so that it can be reused whether such kind of payload occur.
Tried to create content block with following information
<div class="acr-structure acd-loop" data-structure-id="1-1-column" data-structure-name="richtext.structure_1_1_column">
<table class="structure__table" align="center" cellpadding="0" cellspacing="0" border="0" width="100%" style="width: 80%;border: 1px solid #000;">
<tbody>
<tr>
<td style="color: blue; font-weight: Bold; border-bottom: 1px solid #000; border-right: 1px solid #000; padding: 10px;">BrandName</td>
<td style="color: blue; font-weight: Bold; border-bottom: 1px solid #000; padding: 10px;">BrandPrice</td>
</tr>
<tr class="nl-dce-loop" data-nl-loop-id="1670227060166" data-nl-loop-start="1" data-nl-loop-length="3" data-nl-loop-expr="/context/rtEvent/ctx/Content">
<th class="colspan1">
<div class="acr-fragment acr-component" data-component-id="text" contenteditable="false">
<div class="text-container" contenteditable="true">
<div>
<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="color: red; text-align: left; padding: 5px; font-size: 13px; border-right: 1px solid #000;" width="50%">
<span class="acr-field nl-dce-field" data-nl-type="number" contenteditable="false"><b> <%= context.rtEvent.ctx.Content.BrandName %> </b></span> <!-- method 1 or -->
<span class="acr-field nl-dce-field" data-nl-expr="DCECURRENTITEM/BrandName" data-nl-type="number" contenteditable="false">BrandName (BrandName)</span> <!-- method 2 or -->
<span class="acr-field nl-dce-field" data-nl-expr="/context/rtEvent/ctx/Content/BrandName" data-nl-type="number" contenteditable="false">BrandName (BrandName)</span> <!-- method 3 -->
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</th>
<th class="colspan1">
<div class="acr-fragment acr-component" data-component-id="text" contenteditable="false">
<div class="text-container" contenteditable="true">
<div>
<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="50%" style="color: red; text-align: left; padding: 5px; font-size: 13px;">
<span class="acr-field nl-dce-field" data-nl-type="number" contenteditable="false"><b> <%= context.rtEvent.ctx.Content.BrandPrice %> </b></span> <!-- method 1 or -->
<span class="acr-field nl-dce-field" data-nl-expr="DCECURRENTITEM/BrandPrice" data-nl-type="number" contenteditable="false">BrandName (BrandPrice)</span> <!-- method 2 or -->
<span class="acr-field nl-dce-field" data-nl-expr="/context/rtEvent/ctx/Content/BrandPrice" data-nl-type="number" contenteditable="false">BrandName (BrandPrice)</span> <!-- method 3 -->
<br></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</th>
</tr>
</tbody>
</table>
</div>
creating table with BrandName and BrandPrice and fetching its value from Payload and using that as a content block.
is their any other method which can be helpful in content block, if yes please do let me know or anyother alternatives
Note: I am able to achieve desired result without Content block.
Any help is appreciated.
Views
Replies
Total Likes
HI @Parth1
Try this one and adapt it to your targetData context. this one was used for a transactional message (Order Confirmation)
<div style="overflow-x:auto;">
<TABLE class="mayborn_items" border="0" width="100%">
<tbody>
<TR>
<TD style="padding:4px;" align="center" width="5%"></TD>
<TD style="padding:4px;" align="left" width="35%">Name</TD>
<TD style="padding:4px;" align="center" width="15%">Quantity</TD>
<TD style="padding:4px;" align="center" width="15%">Price</TD>
<TD style="padding:4px;" align="center" width="15%">Discount</TD>
<TD style="padding:4px;" align="center" width="15%">Total</TD>
</TR>
<% for (var i =0; i < context.rtEvent.ctx.items.length; i++) { %>
<TR>
<TD style="padding:4px;" align="center"><img src="<%= context.rtEvent.ctx.items[i].thumbnail %>?width=40&height=40&quality=80&mode=crop" style="height: 40px; width: 40px" title="<%= context.rtEvent.ctx.items[i].name %>" alt="<%= context.rtEvent.ctx.items[i].name %>" width="40px" height="40px"> </TD>
<TD style="padding:4px;" align="left"> <%= context.rtEvent.ctx.items[i].name %> </TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.items[i].qty %> </TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.items[i].price %></TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.items[i].discount %></TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.items[i].total %></TD>
</TR> <% } %>
<TR>
</TR>
<TR>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="left">VAT / Sales Tax (included)</TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.vatTotalCost %></TD>
</TR>
<TR>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="left"><%= context.rtEvent.ctx.deliveryType %></TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.deliveryTypeCost %></TD>
</TR>
<TR>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="left">Grand Total</TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"></TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.grandTotal %></TD>
</TR>
</tbody>
</TABLE>
</div>
I used this code inside Content block. it doesnt work.
What is the payload that you have used?
<div style="overflow-x:auto;">
<TABLE class="mayborn_items" border="0" width="100%">
<tbody>
<TR>
<TD style="padding:4px;" align="center" width="5%"></TD>
<TD style="padding:4px;" align="left" width="35%">BrandName</TD>
<TD style="padding:4px;" align="center" width="15%">BrandPrice</TD>
</TR>
<% for (var i =0; i < context.rtEvent.ctx.Content.length; i++) { %>
<TR>
<TD style="padding:4px;" align="center"> </TD>
<TD style="padding:4px;" align="left"> <%= context.rtEvent.ctx.Content[i].BrandName %> </TD>
<TD style="padding:4px;" align="center"><%= context.rtEvent.ctx.Content[i].BrandPrice %></TD>
</TR> <% } %>
<TR>
</TR>
</tbody>
</TABLE>
</div>
Views
Replies
Total Likes
Views
Likes
Replies