Home / Prestashop Module Tutorials / Ap Page Builder / Error Address token not defined when create or edit widget | Ap Pagebuilder Module
error-address-token-not-defined-when-create-and-edit-widget
error-address-token-not-defined-when-create-and-edit-widget

Error Address token not defined when create or edit widget | Ap Pagebuilder Module

 

Ap Page builder – a powerful module with strong features in back-office that allow you to manage, customize, edit your website quickly.  One of the outstanding functions of this Prestashop Module is to make it possible for you to create and edit widgets in Ap Hook Builder.

 

1. Edit Widget in Ap Hook Builder

You can easily edit HTML right on a popup with available handy options.

 

Edit HTML
Edit HTML

2. Error when create and edit widget

However, sometimes, when you create and edit the widget, the popup doesn’t display the right options for you to edit. You can realize this error displayed at all widgets that have edit part as the picture below

 

Error in Edit HTML
Error in Edit HTML

 

When facing this problem, do not panic.

what you need to do first is to press F12 then select Console, you will see the error report:

Uncaught ReferenceError: address_token is not defined in file admin.js?v=1.7.6.2

 

Error address token not defined
Error address token not defined

 

Now I will guide you on how to deal with it.

Firstly, you access the file via Ftp YOUR_SITE/modules/appagebuilder/views/js/admin/home.js

then find code inline 574

$('#modal_form .modal-body').html(data);

 

replace to 

//fix bug prestashop 1.7.6.2 can not get address_token

  if (typeof address_token === "undefined") {
                     var match = RegExp('[?&]' + 'token' + '=([^&]*)').exec(window.location.search);
 address_token = match && decodeURIComponent(match[1].replace(/\+/g, ' '));                                                     
                     }
   $('#modal_form .modal-body').html(data);

 

or you can download in this URL and replace
https://drive.google.com/file/d/1YHw7b2C4OHRoplzVZobMhttbnnJ4pGgF/view?usp=sharing

 

Now everything is back to work. You can continue to create and edit the widget.

Good luck with Ap Page Builder Module.

 

About Luu Ly

Check Also

Error-ap-pagebuilder-blank-when-update-prestashop-1761

Error with Ap Pagebuilder in Prestashop version 1.7.6.1

  This article is to give you the solution with error with Ap Pagebuilder Prestashop …