Search result
An error occurred while processing the template.
The following has evaluated to null or missing:
==> restClient.get("/headless-commerce-delivery-catalog/v1.0/channels/${commerceChannelId}/products/${productId}/categories").items [in template "FUNCTIONS__RESULTADOS_DE_LA_BUSQUEDA_PLANTILLA" at line 48, column 39]
----
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: #assign productCategories = restClien... [in template "FUNCTIONS__RESULTADOS_DE_LA_BUSQUEDA_PLANTILLA" in function "getProductCategories" at line 48, column 10]
----
1<#-- Template: functions - Resultados de la búsqueda Plantilla -->
2<#import "${templatesPath}/FUNCTIONS__RESULTADOS_DE_LA_BUSQUEDA_PLANTILLA" as functions />
3<!-- URL dinamica del site donde se encuentra-->
4<#assign publicGroupURL = themeDisplay.getScopeGroup().getPathFriendlyURL(false, themeDisplay) + themeDisplay.getScopeGroup().getFriendlyURL() >
5<#assign
6 commerceContext = renderRequest.getAttribute("COMMERCE_CONTEXT")
7 commerceChannelId = commerceContext.getCommerceChannelId()
8/>
9<#assign elementoArray = [] />
10<#assign elementos = [] />
11<#-- Recorremos 1 vez el entries -->
12<#if entries?has_content>
13<#list entries as entry>
14<#assign definitionId = entry.getCPDefinitionId()
15definitionService = serviceLocator.findService("com.liferay.commerce.product.service.CPDefinitionLocalService")
16definition = definitionService.getCPDefinition(definitionId)
17productId = definition.getCProduct().getCProductId()
18referenceCode = definition.getCProduct().getExternalReferenceCode()
19/>
20<#assign elemento = {"name": entry.getName(), "description": entry.getDescription() ,"url": entry.getUrl(), "productId": productId, "referenceCode": referenceCode, "entradas": entry, "definitionId": definitionId} />
21<#assign elementos = elementos + [elemento] />
22</#list>
23</#if>
24<#-- Recorremos 1 vez el entries -->
25<#if elementos?has_content>
26<section class="product__list_${randomNamespace}">
27 <div class="row">
28 <#list elementos as item>
29 <#assign
30 skuProduct = functions.getSkuProduct(item.productId, commerceChannelId, "")
31 skuProductCss = functions.getSkuProductCss(skuProduct, item.definitionId)
32 varCategory = functions.getProductCategories(item.productId, commerceChannelId, "")
33 />
34 <div class="col-xl-3 col-lg-4 col-md-6 col-12 mb-5 product__list_height">
35 <div class="product__list_img text-center">
36 <div class="row">
37 <div class="col-4">
38 <span class="pl-2 pt-2 ${skuProductCss}"><@liferay.language key="product.sku" /></span>
39 </div>
40 <div class="col-8">
41
42 <#-- category name -->
43<div class="product__list_categories">
44
45 <span class="text-right pr-2 pt-2 pb-2 sku-product">
46 <@liferay.language key="${varCategory?lower_case}.key" />
47 </span>
48</div>
49 <#-- category name -->
50
51
52 </div>
53 </div>
54
55 <#-- ajustar referencia en segunda fila para no cortarse -->
56 <div class="row">
57 <div class="col-12">
58 <span class="pl-2 pb-2 ${skuProductCss}">${skuProduct}</span>
59 </div>
60 </div>
61 <#-- ajustar referencia en segunda fila para no cortarse -->
62 <a alt="${item.name}" href="${publicGroupURL}/p/${item.url}">
63 <#assign productImage = restClient.get("/headless-commerce-delivery-catalog/v1.0/channels/${commerceChannelId}/products/${item.productId}/images").items />
64
65 <#global counter = 0 />
66 <#list productImage as items>
67 <#if counter < 1 && items.priority == 0>
68 <img alt="${item.name?replace('&', " ", 'r')}" loading="lazy" id="load--product--${item.productId}_${randomNamespace}" class="lazyload img-fluid" src="/o/adaptive-media/image/${items.fileEntryId}/product-catalog/${items.title}" />
69 <#global counter = counter + 1 />
70 </#if>
71 </#list>
72 </a>
73 </div>
74 <div class="row pb-4 align-items-center">
75 <div class="col-lg-6">
76 <@liferay_commerce_ui["compare-checkbox"]
77 CPCatalogEntry=item.entradas
78 label=languageUtil.get(request, "compare")
79 />
80 </div>
81 <#if themeDisplay?has_content && themeDisplay.isSignedIn()>
82 <div class="col-lg-6 text-right">
83 <@liferay_commerce_ui["add-to-wish-list"]
84 CPCatalogEntry=item.entradas
85 />
86 </div>
87 </#if>
88 </div>
89 <h2 class="product__list_title pb-3 mb-0"><a alt="${item.name}" href="${publicGroupURL}/p/${item.url}">${item.name}</a></h2>
90 <#-- <div class="product__list_description pb-3">${stringUtil.shorten(htmlUtil.stripHtml(item.description), 150,"...")}</div> -->
91 <div class="button-holder">
92 <a class="btn btn-primary" href="${publicGroupURL}/p/${item.url}">
93 <@liferay.language key='details' />
94 </a>
95 </div>
96 </div>
97 </#list>
98 </div>
99</section>
100 <#-- Ajustar altura para alinear botones -->
101<script>
102 $(document).ready(function() {
103 function adjustHeights() {
104 if ($(window).width() > 767.98) {
105 var highestBox = 0;
106 $('.product__list_height .product__list_title').css('height', 'auto').each(function() {
107 highestBox = Math.max(highestBox, $(this).height());
108 });
109 $('.product__list_height .product__list_title').height(highestBox);
110 } else {
111 $('.product__list_height .product__list_title').css('height', 'auto');
112 }
113 }
114 adjustHeights();
115 $(window).resize(adjustHeights);
116});
117</script>
118 <#-- Ajustar altura para alinear botones -->
119<script type="text/javascript">
120 window.dataLayer = window.dataLayer || [];
121 window.dataLayer.push({
122 event: 'view_item_list',
123 ecommerce: {
124 items: [
125 <#list elementos as analytcsEntries>
126 {
127 item_name: '${analytcsEntries.name}',
128 item_id: '${analytcsEntries.referenceCode}',
129 index: ${analytcsEntries_index + 1}
130 }<#if analytcsEntries?has_next>,</#if>
131 </#list>
132 ]
133 }
134 });
135</script>
136
137<#else>
138<div class="alert alert-info mt-5">
139 <@liferay.language key='catalog.general.search.empty' />
140</div>
141</#if>
142<style>
143 /*faceta*/
144 [id^="fragment-"] .portlet-cp-specification-option-facets .panel .panel-header {
145 padding: 30px !important;
146 padding-bottom: 16px !important;
147 padding-top: 8px !important;
148 padding-left: 0px !important;
149}
150 /*faceta*/
151 @media screen and (max-width: 991px) {
152 [id^="fragment-"] .portlet-cp-specification-option-facets .panel .panel-header {
153 max-width: 14rem;
154 }
155}
156 /*faceta*/
157 [id^="fragment-"] .portlet-cp-specification-option-facets .panel .panel-header span{
158 text-transform: initial!important;
159 }
160 /*faceta*/
161 @media (max-width: 767px) {
162 [id^="fragment-"] .portlet-commerce-product-publisher .pagination-bar .pagination .page-item, [id^="fragment-"] .portlet-cp-search-results .pagination-bar .pagination .page-item{
163 width: 35px;
164 height: 35px;
165 margin-left: 0.15rem;
166 margin-right: 0.15rem;
167 }
168 [id^="fragment-"] .portlet-commerce-product-publisher .pagination-bar .pagination .page-item .page-link, [id^="fragment-"] .portlet-cp-search-results .pagination-bar .pagination .page-item .page-link{
169 font: normal normal normal 12px/14px Lexend;
170 }
171 }
172 .portlet-cp-sorting .dropdown-menu a[data-label="relevance"],
173 .portlet-cp-sorting .dropdown-menu a[data-label="price-low-to-high"],
174 .portlet-cp-sorting .dropdown-menu a[data-label="price-high-to-low"]{
175 display: none;
176 }
177 .product__list_${randomNamespace} .product__list_img img{
178 width: 342px;
179 height: 230px;
180 object-fit: contain;
181 }
182 .product__list_${randomNamespace} .product__list_img{
183 margin-bottom: 22px;
184 background: white;
185 }
186 .product__list_${randomNamespace} .product__list_title{
187 font: normal normal 600 18px/22px Lexend;
188 letter-spacing: 0px;
189 color: #2C2C2C;
190 }
191 .product__list_${randomNamespace} .product__list_description{
192 font: normal normal 400 16px/26px Lexend;
193 letter-spacing: -0.48px;
194 color: #5C5C5C;
195 }
196 .product__list_${randomNamespace} .add-to-wish-list .wish-list-icon{
197 margin: 0;
198 }
199 .product__list_${randomNamespace} .add-to-wish-list .wish-list-icon .lexicon-icon-heart{
200 color: white;
201 }
202 .product__list_${randomNamespace} .add-to-wish-list .wish-list-icon .lexicon-icon-heart-full{
203 color: red;
204 }
205 .product__list_${randomNamespace} .add-to-wish-list .btn{
206 padding: 12px;
207 margin-right: 0;
208 background: #E8E8E8 0% 0% no-repeat padding-box;
209 border-color: #E8E8E8;
210 }
211 .product__list_${randomNamespace} .add-to-wish-list .text-truncate-inline{
212 display: none;
213 }
214 .product__list_${randomNamespace} .custom-checkbox input {
215 padding: 0;
216 height: initial;
217 width: initial;
218 margin-bottom: 0;
219 display: none;
220 cursor: pointer;
221 }
222 .product__list_${randomNamespace} .custom-checkbox label {
223 position: relative;
224 cursor: pointer;
225 }
226 .product__list_${randomNamespace} .custom-checkbox .custom-control-input:checked~.custom-control-label::after{
227 background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%3E%3Cpath%20class='lexicon-icon-outline'%20d='M220.9%20377.2c-8%200-15.8-3.2-21.5-8.9l-91-91c-28.1-28.1%2014.8-71%2042.9-42.9l68.2%2068.2%20139.8-157.2c26.4-30%2072%2010.1%2045.6%2040.1L243.7%20366.9c-5.5%206.3-13.4%2010-21.8%2010.3h-1z'%20fill='%2358A031'/%3E%3C/svg%3E");
228 background-size: 100%;
229 background-position: 2px 2px;
230 }
231 .product__list_${randomNamespace} .custom-checkbox label:before {
232 content:'';
233 -webkit-appearance: none;
234 background: #E8E8E8 0% 0% no-repeat padding-box;
235 border-radius: 6px;
236 padding: 10px;
237 display: inline-block;
238 position: relative;
239 vertical-align: middle;
240 cursor: pointer;
241 margin-right: 5px;
242 }
243 .product__list_${randomNamespace} .custom-control{
244 margin-left: -16px;
245 }
246 .product__list_${randomNamespace} .custom-checkbox label .custom-control-label::before{
247 visibility: hidden;
248 }
249 .product__list_${randomNamespace} .custom-checkbox input:checked + label:after {
250 content: '';
251 display: block;
252 position: absolute;
253 top: 2px;
254 left: 9px;
255 width: 6px;
256 height: 14px;
257 border: solid #0079bf;
258 border-width: 0 2px 2px 0;
259 transform: rotate(45deg);
260 }
261 .product__list_${randomNamespace} .sku-product{
262 text-align: left;
263 display: block;
264 color: var(--sma-grease3);
265 font-weight: 500;
266 line-height: 1rem !important;
267 }
268 /*problema a la hora de mostrar el sort*/
269 .sma-container .lfr-layout-structure-item-row {
270 overflow: visible;
271 }
272</style>