Jump to content

Form Fields not working in hookDisplayAdminProductsExtra


ilmtech

Recommended Posts

  • 2 months later...
  • 2 months later...

I did not check this in latest 1.7.0 but think new thing and bit confusing part is naming your form fields.

 

Check this http://build.prestashop.com/news/module-development-changes-in-17/#changes-for-modules-targeting-the-product-page

 

 

 

Form fields

The form field names must be created in an array hook of this format: [MODULE_NAME][iNPUT_NAME].

 

Not sure if there is better explanation somewhere in code or on github but here is what worked for me after some guessing.

Here is one HTML, but if Helpers are used it is just naming input right.

<input type="hidden" id="mymodule_id_my_field_{$attribute['id_product_attribute']}" name="hook[my_module][id_my_field][{$attribute['id_product_attribute']}]" value="">

So I used actual word "hook" and module name and field name:  hook[my_module][id_my_field]

 

Then in  function hookActionProductUpdate code like this

$hook_array = Tools::getValue("hook");

$id_my_field = (int)$hook_array["mymodule"]["id_my_field"];

Hope someone find this useful and could confirm. And if there is better, clear explanation, please share.

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...