Uncaught reference error with Prestashop Module

The error apears when i click the blue "add row" button". Any help trying to troubleshoot the problem?

Jquery is loaded before the tool and the script is run after the page is loaded

error occurs in line 9 of this code:

if($.isEmptyObject(num)) // check if any row already exist if not set 1
    num = 1;
else // check if any row already exist if yes set max + 1
    num = Math.max.apply(Math,num) + 1;

html += '<div id="megamenu-row-'+num+'" class="megamenu-row row">';
    html += '<div class="clearfix">';
        html += '<div class="add-column-button-container col-lg-6">';
            html += '<a href="#" onclick="return false;" class="btn btn-success add-megamenu-col">'+add_megamenu_column+'</a>';
        html += '</div>';
        html += '<div class="remove-row-button col-lg-6 text-right">';
            html += '<a class="btn btn-danger btn-remove-row" href="#" onclick="return false;">'+btn_remove_row_text+'</a>';
        html += '</div">';
    html += '</div>';
    html += '<input type="hidden" name="row_content" />';
html += '</div>';

return html;    

}

Answers


You might imported some products/categories with wrong \r or \n in their names and this brokes up back.js. Replace in /modules/tmmegamenu/views/templates/admin/additem.tpl on line 223

{addJsDef option_list=$option_select}

on

{addJsDef option_list=$option_select|replace:"\r":""|replace:"\n":""}

This should works.


Need Your Help

AspectJ confusion with pointcut

java aop aspectj pointcuts

How can I express a point cut that finds methods only when being called from within another method, but not directly?

Asp.net MVC Block a user from accessing entire application on certain conditions

asp.net asp.net-mvc asp.net-mvc-3

I have a website that has for examples pages A, B, C, D,.... I want that the user can only access page A once he has registered. To access the remaining pages the user needs to complete some joining