Jump to content

Invalid security token Error, please help me


Recommended Posts

im creating a new module for prestashop 1.5.6 and im having some problems with it.

The module has to send sms to the costumers and it has to be an option of the back-Office menu.

I have created the module with the install and uninstall functions and added the tabs to the back-office menu, but im a newbie in prestashop so i don´t know how to make the AdminMyModuleController.php and when i try to click the tab of the module it says "INVALID SECURITY TOKEN", i don´t know how resolve this issue because i don´t know much of security.

If someone can add me on facebook or whatever to help me would be amazing.

Here is the code of the mymodule.php:

private function _createTab() {

// Tab Raiz

$data = array(
'id_tab' => '',
'id_parent' => 0,
'class_name' => 'Empty',
'module' => 'mymodule',
'position' => 14, 'active' => 1
);

/* Insert the data to the tab table*/
$res = Db::getInstance()->insert('tab', $data);

//Get last insert id from db which will be the new tab id
$id_tabP = Db::getInstance()->Insert_ID();

//Define tab multi language data $data_lang = array( 'id_tab' => $id_tabP, 'id_lang' => Configuration::get('PS_LANG_DEFAULT'), 'name' => 'SMS a clientes' );

// Now insert the tab lang data
$res &= Db::getInstance()->insert('tab_lang', $data_lang);

// Tab Configuracion

$data = array(
'id_tab' => '',
'id_parent' => $id_tabP,
'class_name' => 'AdminMymodule',
'module' => 'mymodule',
'position' => 1, 'active' => 1
);

$res = Db::getInstance()->insert('tab', $data);
$id_tab = Db::getInstance()->Insert_ID();
$data_lang = array(
'id_tab' => $id_tab,
'id_lang' => Configuration::get('PS_LANG_DEFAULT'),
'name' => 'Configuracion'
);
$res &= Db::getInstance()->insert('tab_lang', $data_lang);

// Tab Enviar Sms

$data = array(
'id_tab' => '',
'id_parent' => $id_tabP,
'class_name' => 'AdminEnviar',
'module' => 'mymodule',
'position' => 1, 'active' => 1
);


$res = Db::getInstance()->insert('tab', $data);
$id_tab = Db::getInstance()->Insert_ID();

$data_lang = array(
'id_tab' => $id_tab,
'id_lang' => Configuration::get('PS_LANG_DEFAULT'),
'name' => 'Enviar SMS'
);

$res &= Db::getInstance()->insert('tab_lang', $data_lang);

return true;

}

Thanks

 

post-774396-0-77149700-1395318223_thumb.png

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More