Si è verificato un errore nell'elaborarazione del modello.
Error on line 76, column 7 in 21447#21485#785470
SuggestoRecommenderServiceAPI.search(groupId?string,serviceName,"",queryStringMG1,"",0,1) is undefined.
It cannot be assigned to items
1<#-- 
2  eCTRL Solutions 
3  EROGATORE WIDGET HTML CARD 
4   ver: 1.9 
5  data: 19/11/2021 
6 
7  DEBUG 
8  Freemarker online: http://freemarker-online.kenshoo.com/ 
9 
10--> 
11<#compress> 
12 
13<#setting url_escaping_charset="UTF-8"> 
14 
15<#-- Configuration --> 
16<#assign baseUrl = "https://cdnmks.suggesto.eu"> 
17<#assign oCBan = "WIDGET_CARD" > 
18<#assign groupId = 316751> 
19<#assign serviceName = "mongoVtnSolr"> 
20<#assign serviceNameLR = "solrLiferay"> 
21<#-- Configuration --> 
22 
23<#-- Default params --> 
24<#assign oL = "it_IT" > 
25<#assign oLDefault = "it_IT" > 
26<#assign dbg = "F"> 
27<#assign oCLnk = "STYLE1" > 
28<#assign oCStyle = "" > 
29<#assign oCTit = "9ebcd1db-982e-4fc8-a5c6-05191d0ba4df" > 
30<#assign oCHost = ""> 
31<#-- Default params --> 
32 
33<#assign rimg = ""> 
34<#assign rhtml = ""> 
35 
36<#-- services --> 
37<#assign SuggestoRecommenderServiceAPI = serviceLocator.findService("suggestocs-portlet","eu.suggesto.servicecs.service.SuggestoRecommenderService")> 
38<#assign SuggestoCSServiceAPI = serviceLocator.findService("suggestocs-portlet","eu.suggesto.servicecs.service.SuggestoCSService")> 
39 
40<#if request.parameters?has_content> <#-- 1 --> 
41 
42  <#-- from param config --> 
43  <#if request.parameters["jwcfg"]?has_content> <#-- 2 --> 
44    <#assign szjwcfg = request.parameters["jwcfg"]> 
45    <#assign wjcdata = jsonFactoryUtil.createJSONObject(szjwcfg)> 
46 
47    <#if wjcdata ??> <#-- 3 --> 
48      <#assign oL = wjcdata.getString("oL", "it_IT")> 
49      <#assign oCLnk = wjcdata.getString("oCLnk", "STYLE1")> 
50      <#assign oCStyle = wjcdata.getString("oCStyle", "")> 
51      <#assign oCTit = wjcdata.getString("oCTit", "9ebcd1db-982e-4fc8-a5c6-05191d0ba4df")> 
52      <#assign dbg = wjcdata.getString("dbg", "F")> 
53      <#assign oCHost = wjcdata.getString("oCHost", "")> 
54    </#if> <#-- 3 --> 
55     
56    <#-- 1) find marketing group and region from feratelid --> 
57    <#-- Card trentino --> 
58    <#assign queryStringMG1 = "ns:vtn.accommodationslist AND  suggestoId:"+oCTit > 
59    <#-- Payd guestcard --> 
60    <#assign queryStringMG2 = "ns:vtn.accommodationslist AND  suggestoId:"+oCTit > 
61    <#-- Search Liferay Doc --> 
62    <#assign queryStringLD = "" >     
63     
64    <#assign itemFound = false> 
65 
66    <#-- museum pass --> 
67    <#if oCTit == "MUSEUMPASS"> 
68       <#assign queryStringLD = "scopeGroupId:316751 AND ddm/785468/market_it_IT:MP AND head:true AND status:0" > 
69       <#assign itemFound = true> 
70       <@searchAndRenderCard queryStringLD /> 
71    <#elseif oCTit == "VACANZESICURE"> 
72       <#assign queryStringLD = "scopeGroupId:316751 AND ddm/785468/market_it_IT:VS AND head:true AND status:0" > 
73       <#assign itemFound = true> 
74       <@searchAndRenderCard queryStringLD /> 
75    <#else> 
76      <#assign items = SuggestoRecommenderServiceAPI.search(groupId?string,serviceName,"",queryStringMG1,"",0,1) > 
77       
78      <#if items.getJSONObject("data")?has_content > 
79        <#if items.getJSONObject("data").getJSONObject("response").getString("numFound") == "1" >  
80          <#assign itemFound = true> 
81        </#if>   
82      <#else> 
83        <#assign items = SuggestoRecommenderServiceAPI.search(groupId?string,serviceName,"",queryStringMG2,"",0,1) > 
84        <#if items.getJSONObject("data")?has_content > 
85          <#if items.getJSONObject("data").getJSONObject("response").getString("numFound") == "1" >  
86            <#assign itemFound = true> 
87          </#if>     
88        </#if> 
89      </#if> 
90 
91      <#if itemFound> 
92        <#if items.getJSONObject("data").getJSONObject("response")?has_content> 
93          <#if items.getJSONObject("data").getJSONObject("response").getJSONArray("docs")?has_content> 
94              <#assign docs = items.getJSONObject("data").getJSONObject("response").getJSONArray("docs")> 
95              <#assign areaId = docs.getJSONObject(0).getJSONArray("areaId").getString(0)> 
96              <#assign queryStringLD = "scopeGroupId:316751 AND ddm/785468/apt_it_IT:"+areaId+" AND head:true" > 
97 
98              <@searchAndRenderCard queryStringLD /> 
99          </#if> 
100        </#if> 
101      </#if> <#-- end itemFound --> 
102    </#if>   
103     
104 
105    <#if itemFound == false> 
106      Non è stata trovata associazione ad una GuestCard. <br/> Per ulteriori informazioni contattare Trentino Marketing. 
107    </#if> 
108     
109  </#if> <#-- 2 --> 
110 
111</#if> <#-- 1 --> 
112 
113 
114<#macro searchAndRenderCard queryStringLD> 
115    <#assign itemsLR = SuggestoRecommenderServiceAPI.search("0",serviceNameLR,"",queryStringLD,"",0,1) > 
116    <#if itemsLR.getJSONObject("data")?has_content > 
117        <#assign docsLR = itemsLR.getJSONObject("data").getJSONObject("response").getJSONArray("docs")> 
118        <#assign articleId = docsLR.getJSONObject(0).getString("articleId")>  
119        <#assign lrArticle = SuggestoCSServiceAPI.getDocument("316751","journal","journal",articleId) > 
120        <#if lrArticle.getJSONObject("data").getJSONObject("document")?has_content> 
121        <#assign lrCJ = lrArticle.getJSONObject("data").getJSONObject("document").getJSONObject("contentJSON") > 
122        <#-- style1 --> 
123        <#if oCLnk == "STYLE1"> 
124          <#assign oCStyle = "STYLE1"> 
125          <#assign img = lrCJ.getJSONObject("img").getJSONObject("dynamic-content").getString(oL) > 
126          <#if (img == "")> 
127              <#assign img = lrCJ.getJSONObject("img").getJSONObject("dynamic-content").getString("it_IT") > 
128          </#if> 
129          <@renderHTMLImage img />  
130        </#if> 
131        <#-- style2 --> 
132        <#if oCLnk == "STYLE2"> 
133          <#assign oCStyle = "STYLE2"> 
134          <#assign img = lrCJ.getJSONObject("img2").getJSONObject("dynamic-content").getString(oL) > 
135          <#if (img == "")> 
136              <#assign img = lrCJ.getJSONObject("img2").getJSONObject("dynamic-content").getString(oLDefault) > 
137          </#if> 
138          <@renderHTMLImage img />  
139        </#if> 
140        <#-- style3 --> 
141        <#if oCLnk == "STYLE3"> 
142          <#assign oCStyle = "STYLE3"> 
143          <#assign img = lrCJ.getJSONObject("img3").getJSONObject("dynamic-content").getString(oL) > 
144          <#if (img == "")> 
145              <#assign img = lrCJ.getJSONObject("img3").getJSONObject("dynamic-content").getString(oLDefault) > 
146          </#if> 
147          <@renderHTMLImage img />  
148        </#if> 
149        <#-- htmlOverlay --> 
150        <#if oCLnk == "HTML"> 
151          <#assign htmlOverlay = lrCJ.getJSONObject("htmlOverlay").getJSONObject("dynamic-content").getString(oL) > 
152          <#if (htmlOverlay == "")> 
153              <#assign htmlOverlay = lrCJ.getJSONObject("htmlOverlay").getJSONObject("dynamic-content").getString(oLDefault) > 
154          </#if> 
155          <@renderHTMLOver htmlOverlay />  
156          </#if> 
157        <#else> 
158        ${articleId} 
159         </#if> 
160          
161    </#if> 
162 
163</#macro> 
164 
165<!-- renderHTMLImage --> 
166<#macro renderHTMLImage rimg > 
167  <div id="ex1" style="display:none;" > 
168    <iframe id="ex1iframe" scrolling="auto" seamless="seamless" style="width:100%;height:100%;overflow:hidden;border: 0" src="${baseUrl}/web/vtn/cr?p_p_id=articledetailOneInstance_WAR_suggestoguiportlet&p_p_lifecycle=2&p_p_resource_id=asHtml&_articledetailOneInstance_WAR_suggestoguiportlet_jwcfg=%20{%22oL%22:%22${oL}%22,%22oCLnk%22:%22HTML%22,%22oCTit%22:%22${oCTit}%22,%22oCHost%22:%22${oCHost}%22,%22oCStyle%22:%22${oCStyle}%22}"></iframe> 
169  </div> 
170  <a href="#ex1" rel="modal:open"><img onclick="ectwSendOpenEvent()" src="${baseUrl}${rimg}" /></a> 
171  <script> 
172    function ectwSendOpenEvent() { 
173      console.log("ectwSendOpenEvent"); 
174      document.getElementById('ex1iframe').contentWindow.postMessage('open','https://cdnmks.suggesto.eu/'); 
175
176  </script> 
177   
178</#macro> 
179 
180<!-- renderHTMLOver --> 
181<#macro renderHTMLOver rhtml> 
182 
183  ${rhtml?replace("##REFURL##", oCHost)} 
184  <!-- v 1.4 --> 
185   
186  <!-- Google Analytics --> 
187  <script> 
188    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
189    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
190    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
191    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 
192       
193    //  http://widget.visittrentino.it 
194 
195    ga('create', 'UA-3691070-14', 'auto'); 
196    ga('set', 'page', '/card2/view/${oCTit}/${oCStyle}'); 
197    ga('send', 'pageview'); 
198 
199    function receiver(event) { 
200      if (event.data == 'open') { 
201        ga('set', 'page', '/card2/open/${oCTit}/${oCStyle}'); 
202        ga('send', 'pageview'); 
203
204
205    window.addEventListener('message', receiver, false); 
206 
207  </script> 
208  <!-- End Google Analytics --> 
209 
210</#macro> 
211 
212</#compress>