Jump to content

Edit History

JohnKS

JohnKS

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

JohnKS

JohnKS

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 methods='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

×
×
  • Create New...