Category Filter

An error occurred while processing the template.
The following has evaluated to null or missing:
==> currentCategoryId  [in template "20099#20135#137620" at line 65, column 26]

----
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: #if currentCategoryId == category.get...  [in template "20099#20135#137620" at line 65, column 21]
----
1<style> 
2.pagination{ 
3    justify-content: center; 
4
5.pagination .page-item{ 
6    padding-right: 12px; 
7
8.pagination .disabled>a, .pagination .disabled>a:hover, .pagination .disabled>a:focus, .pagination .disabled>span { 
9    background-color: #fff; 
10    color: #6c757d; 
11    cursor: not-allowed; 
12
13.pagination li>a, .pagination li>span { 
14    background-color: #fff; 
15    border: 1px solid #dee2e6; 
16    border-radius: 15px; 
17    display: inline-block; 
18    padding: 5px 14px; 
19
20</style> 
21<#assign  
22    assetCategoryLocalServiceUtil = staticUtil["com.liferay.asset.kernel.service.AssetCategoryLocalServiceUtil"] 
23/> 
24<!-- Recuperar valores de las preferencias del portlet --> 
25<#list portletPreferences?keys as preference> 
26    <#if portletPreferences[preference] ??> 
27        <#assign mapValues = portletPreferences[preference] /> 
28        <#list mapValues as value > 
29            <#if preference == "assetVocabularyIds"> 
30                <#assign assetVocabularyIds = value /> 
31            </#if> 
32        </#list> 
33    </#if> 
34</#list> 
35<!--  
36    Vamos a comprobar si viene categoryId. Esto quiere decir que viene de una petición para mostrar todas las entradas de  
37    una categoría 
38    Si es así pintamos el título como el de la categoría 
39--> 
40<#attempt> 
41    <#if assetVocabularyIds??> 
42        <#assign  childCategoriesVocabulary = assetCategoryLocalServiceUtil.getVocabularyRootCategories(assetVocabularyIds?number, -1, -1, null) /> 
43    </#if> 
44    <#if renderRequest.getParameter("categoryId")??> 
45        <#assign  
46            currentCategoryId = renderRequest.getParameter("categoryId")?number 
47            currentCategory = assetCategoryLocalServiceUtil.getCategory(currentCategoryId) 
48            childCategories = assetCategoryLocalServiceUtil.getChildCategories(currentCategoryId) 
49        /> 
50    </#if> 
51<#recover> 
52     
53</#attempt> 
54 
55<div class=""> 
56    <div class="container2"> 
57        <div style=""> 
58            <span>Preguntas Frecuentes en la categor&iacute;a:</span>&nbsp; 
59            <#if childCategoriesVocabulary?? && childCategoriesVocabulary?has_content> 
60                <#assign categories = childCategoriesVocabulary> 
61                <select id="selectCategoyId"> 
62                <#list categories as category> 
63                    <#assign childCategories = assetCategoryLocalServiceUtil.getChildCategories(category.getCategoryId()) /> 
64                    <#assign selected="" /> 
65                    <#if currentCategoryId == category.getCategoryId()> 
66                    <#assign selected="selected" /> 
67                    </#if> 
68                    <option ${selected} value="${category.getCategoryId()}">${category.getName()}</option> 
69                    <#list childCategories as categoryChild> 
70                        <#assign selected="" /> 
71                        <#if currentCategoryId == categoryChild.getCategoryId()> 
72                        <#assign selected="selected" /> 
73                        </#if> 
74                        <option ${selected} value="${categoryChild.getCategoryId()}">-- ${categoryChild.getName()}</option> 
75                    </#list> 
76                </#list> 
77                </select> 
78            </#if> 
79        </div> 
80    </div> 
81</div> 
82 
83<script> 
84    $('#selectCategoyId').on('change', function () { 
85        console.log($(this).val()); 
86        <#assign categoryURL = renderResponse.createRenderURL()> 
87		${categoryURL.setParameter("resetCur", "true")} 
88		${categoryURL.setParameter("categoryId", "categoryIdValue")} 
89		var url = "${categoryURL}"; 
90		url = url.replace("categoryIdValue", $(this).val()); 
91		console.log(url); 
92		window.location.href = url; 
93    }); 
94</script>