347 Products Available
An error occurred while processing the template.
The following has evaluated to null or missing:
==> productDetail.urlImage [in template "37794063322763#20119#53162" at line 38, column 51]
----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: defaultImageURL = productDetail.urlIm... [in template "37794063322763#20119#53162" at line 38, column 33]
----
1<#assign
2 defaultImgMap = {
3 "220": "/documents/d/guest/220-coming-soon",
4 "220EV": "/documents/d/guest/220ev-coming-soon",
5 "520": "/documents/d/guest/520-coming-soon",
6 "389": "/documents/d/guest/389-coming-soon",
7 "520EV": "/documents/d/guest/520ev-coming-soon",
8 "535": "/documents/d/guest/535-coming-soon",
9 "536": "/documents/d/guest/536-coming-soon",
10 "537": "/documents/d/guest/537-coming-soon",
11 "548": "/documents/d/guest/548-coming-soon",
12 "567": "/documents/d/guest/567-coming-soon",
13 "579": "/documents/d/guest/579-coming-soon",
14 "579EV": "/documents/d/guest/579ev-coming-soon",
15 "589": "/documents/d/guest/589-coming-soon"
16 }
17 />
18<#assign
19 commerceContext = renderRequest.getAttribute("COMMERCE_CONTEXT")
20 account = commerceContext.getAccountEntry()
21 accountId = account.getAccountEntryId()
22 chanelId = commerceContext.getCommerceChannelId()
23 />
24<div class="product-card-tiles">
25 <#if entries?has_content>
26 <#list entries as curCPCatalogEntry>
27
28 <#assign
29 cpDefinitionId = curCPCatalogEntry.getCPDefinitionId()
30 productId = curCPCatalogEntry.getCProductId()
31 productName = curCPCatalogEntry.getName()
32 productShortDescription = curCPCatalogEntry.getShortDescription()
33 productDescription = curCPCatalogEntry.getDescription()
34 friendlyURL = cpContentHelper.getFriendlyURL(curCPCatalogEntry, themeDisplay)
35 defaultImageURL = cpContentHelper.getDefaultImageFileURL(accountId, cpDefinitionId)
36 defaultImageFileVersion = cpContentHelper.getCPDefinitionImageFileVersion(cpDefinitionId, request)
37 productDetail = restClient.get("/headless-commerce-delivery-catalog/v1.0/channels/${chanelId}/products/${productId}?accountId=${accountId}&nestedFields=categories,productSpecifications")
38 defaultImageURL = productDetail.urlImage?replace('https://localhost', '')
39 fileEntryIdAttr = 'data-fileentryid="' + defaultImageFileVersion.fileEntryId + '"'
40 specifications = productDetail.productSpecifications
41 customFields = productDetail.customFields
42
43 productCategories = restClient.get("/headless-commerce-delivery-catalog/v1.0/channels/${chanelId}/products/${productId}/categories?pageSize=40")
44 categories = productCategories.items
45
46 erc = productDetail.externalReferenceCode
47 infoObj = {}
48 tags = productDetail.tags
49 featuredSpecificationKeys = ["fit", "weight", "material"]
50 isSuggested = false
51 suggestedClass = ""
52
53 visiblePrice = ""
54 miles = ""
55 neworUsed = ""
56 locationName = ""
57 locationId = ""
58 displayPrice = false
59
60 truckBadgesArray = [{"id": "", "value": ""}]
61
62
63 />
64 <#if categories?has_content>
65 <#list categories as category>
66 <#if category.vocabulary?replace(' ', '') = 'truckbadges'>
67 <#assign truckBadgesArray += [{"id": category.id, "value": category.name}] />
68 <#else>
69 <#assign infoObj = infoObj + {category.vocabulary?replace(' ', ''): {"id": category.id, "value": category.name}} />
70 </#if>
71 </#list>
72 <#assign infoObj = infoObj + {"truckbadges": truckBadgesArray} />
73 </#if>
74
75 <div class="d-none">
76 <#list customFields as customField>
77 <#if customField.name = 'Visible Price'>
78 <#assign visiblePrice = customField.customValue.data />
79 </#if>
80
81 <#if customField.name = 'Display Price'>
82 <#assign displayPrice = customField.customValue.data />
83 </#if>
84
85 <#if customField.name = 'Miles'>
86 <#assign miles = customField.customValue.data />
87 </#if>
88 </#list>
89
90 <#if infoObj.year?has_content>
91 <#assign productName = infoObj.year.value />
92 </#if>
93 <#if infoObj.make?has_content>
94 <#assign productName = productName + " " + infoObj.make.value />
95 </#if>
96 <#if infoObj.model?has_content>
97 <#assign productName = productName + " " + infoObj.model.value />
98
99 <#if defaultImageURL?trim?contains('/o/commerce-media/default/?groupId=') || defaultImageURL?trim?contains('commercial-truck-coming-soon')>
100 <#if defaultImgMap[infoObj.model.value?lower_case]?? >
101 <#assign fileEntryIdAttr = '' />
102 <#assign defaultImageURL = defaultImgMap[infoObj.model.value?lower_case] />
103 </#if>
104 </#if>
105
106 </#if>
107
108 <#if categories?has_content>
109 <#list categories as category>
110 <#if category.vocabulary = 'conditions'>
111 <#assign newOrUsed = category.name />
112 <#if category.name = 'Used'>
113 <#assign newOrUsed = 'Pre-Owned'/>
114 </#if>
115 </#if>
116
117 <#if category.vocabulary = 'location'>
118 <#assign locationName = category.name />
119 <#assign locationId = category.id />
120 </#if>
121
122 <!--<span class="btn btn-outline-primary product-category">${category.vocabulary}: ${category.name}</span> -->
123 </#list>
124 </#if>
125
126 <#if specifications?has_content>
127 <#list specifications as specification>
128 <#if featuredSpecificationKeys?seq_contains(specification.specificationKey) >
129 <span class="badge badge-secondary">${specification.value}"</span>
130 </#if>
131 </#list>
132 </#if>
133 </div>
134
135 <#if tags?seq_contains("suggested")>
136 <#assign isSuggested = true />
137 <#assign suggestedClass = "suggested" />
138 </#if>
139 <div class="product-listing-card">
140 <div class="product-card-top click-here-box">
141 <img src="${defaultImageURL}" ${fileEntryIdAttr} class="img-fluid" alt="${productName}" />
142
143 <#if infoObj.truckbadges??>
144 <#list infoObj.truckbadges as truckBadge>
145 <#if truckBadge.value = "Red Oval">
146 <div class="overlay-badge top-right">
147 <img src="/documents/d/guest/red-oval" class="overlay-badge-img red-oval-badge" alt="Red Oval" />
148 </div>
149 </#if>
150
151 <#if truckBadge.value = "Work Ready">
152 <div class="overlay-badge top-left">
153 <img src="/documents/d/guest/work-ready" class="overlay-badge-img work-ready-badge" alt="Work Ready" />
154 </div>
155 </#if>
156 </#list>
157 </#if>
158
159 <#if isSuggested>
160 <div class="aspect-ratio-item-bottom-right">
161 <span class="label label-inverse-primary ${suggestedClass}" >
162 <span class="label-item label-item-expand">
163 Suggested
164 </span>
165 </span>
166 </div>
167 </#if>
168
169 <a href="${friendlyURL}" class="click-here-link d-none">Learn More</a>
170 </div>
171
172 <div class="product-card-body click-here-box ${suggestedClass}">
173 <p class="mb-1">Stock Number: <b>${curCPCatalogEntry.getName()}</b></p>
174 <h3 class="product-card-title ${suggestedClass}" title="${productName}"><a href="${friendlyURL}" class="color-inherit click-here-link">${productName}</a></h3>
175 <div class="product-card-details">
176 <ul class="prod-main-info">
177 <#if displayPrice[0] == "Yes" && visiblePrice?has_content>
178 <#assign formattedPrice = visiblePrice?string.currency>
179 <li class="prod-price">${formattedPrice}</li>
180 <#else>
181 <li class="prod-price">Call For Pricing</li>
182 </#if>
183 <#if miles != "" && miles != "0">
184 <#assign cleanMiles = miles?replace("[^0-9]", "", "r") />
185 <#assign formattedMiles = cleanMiles?number?string('#,##0.###') />
186 <li class="prod-miles"><span class="miles-text">${formattedMiles}</span> mi</li>
187 </#if>
188 </ul>
189
190 <#if newOrUsed??>
191 <span class="new-or-used-badge">${newOrUsed}</span>
192 </#if>
193 </div>
194 </div>
195
196 <div class="product-card-footer">
197 <#if locationName != "">
198 <div class="product-card-location">
199 <p>Available in: <a href="/product-list?location=${locationId}">${locationName}</a></p>
200 </div>
201 </#if>
202 </div>
203
204 </div>
205 </#list>
206 </#if>
207</div>
