Jump to content

Getting Form Values in hookDisplayAdminProductsExtra


JohnKS

Recommended Posts

So I'm trying to create a prestashop module that gets the value of fields in the hookDisplayAdminProductsExtra however I am not gettnig any values. I belive the problem is the submit method not being executed.

Hook Function

Quote

 

  public function hookDisplayAdminProductsExtra()
  {
    if (Tools::isSubmit("submitextra")) {
      $fileName = "newfile.txt";
      $txt = "SUBMIT\n";
      $myfile = fopen($fileName, "w") or die("Unable to open file!");

      if (fwrite($myfile, $txt) === false) {
        echo "Unable to write to file!";
      } else {
        echo "Data written to file successfully!";
      }
      fclose($myfile);
    }

    return $this->display(__FILE__, "views/templates/hook/displayAdminExtra.tpl");
  }

 

  <form method='POST'>
    <h1>{$id_product}</h1>
    <label for="extra">Extra Info</label>
    <input type="text" name='extra' class="form-control">
    <input type="hidden" name="id_product" value="{$id_product}">
    <input type="submit" value="Guardar" name="submitextra">
</form>

TPL File

Edited by JohnKS (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...