Jump to content

mumin3k

Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • First Name
    Rafał
  • Last Name
    Węgzryniak

mumin3k's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, I just started writing my new module, and i have a problem with invalid token value error, here is the code: class UltimateExporter extends Module { function __construct() { $this->name = 'ultimateexporter'; $this->tab = 'administration'; $this->version = '0.1.0'; $this->author = 'me'; parent::__construct(); $this->displayName = $this->l('Ultimate Exporter'); $this->description = $this->l('Under development'); } public function install() { parent::install(); return true; } public function getContent(){ return $this->displayform(); } private function displayForm(){ $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // Init Fields form array $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Export products'), ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('URL aplikacji'), 'name' => 'appURI', 'size' => 63, 'required' => true ), array( 'type' => 'text', 'label' => 'token', 'name' =>'token', 'size' => 511, 'required' => true ) ), 'submit' => array( 'title' => $this->l('EXPORT'), 'class' => 'btn btn-default pull-right' ) ); $helper = new HelperForm(); // Module, token and currentIndex $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; // Language $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; // Title and toolbar $helper->title = $this->displayName; $helper->show_toolbar = true; // false -> remove toolbar $helper->toolbar_scroll = true; // yes - > Toolbar is always visible on the top of the screen. $helper->submit_action = 'submit'.$this->name; $helper->toolbar_btn = array( 'save' => array( 'desc' => $this->l('Saves'), 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name.'&tab_module=administration&module_name=ultimateexporter'. '&token='.Tools::getAdminTokenLite('AdminModules'), ), 'back' => array( 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list') ) ); return $helper->generateForm($fields_form); } } and every time when i click 'save' button I get 'invalid token' error but when I copied action property value from generated form and pasted into adress bar in browser everything works fine. Do you have any ideas what is wrong?
×
×
  • Create New...

Important Information

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