HowTo: Fix Invalid Security Token Error

While trying to add a new cms category or page in prestashop, the ‘invalid security token’ page appears. To know what went wrong, let’s have a look at the URL. The ampersand is displayed as html encoded ‘&’ so it couldn’t be interpreted correctly.

Workaround:

Replace the wrong syntax in the following file ‘controllers/admin/AdminCmsController.php’

'href' => self::$currentIndex.'&add'.$this->table.'&id_cms_category='.(int)$this->id_cms_category.'&token='.$this->token,

with

 'href' => self::$currentIndex.'&add'.$this->table.'&id_cms_category='.(int)$this->id_cms_category.'&token='.$this->token,

Now change the ‘controllers/admin/AdminCmsCategoriesController.php’

$this->toolbar_btn['new']['href'] .= '&id_parent='.(int)Tools::getValue('id_cms_category');

to

 $this->toolbar_btn['new']['href'] .= '&id_parent='.(int)Tools::getValue('id_cms_category');

Done