Jump to content

Custom field, get value in the hook.


crustydod

Recommended Posts

Well hello,

I have a simple module and I want to get a value from a custom field on the AdminOrders page. The value from the field is not saved anywhere and does not exist in any of the tables and should not.

So, back office has additional field:

<input type="text" name="custom_field" id="custom_field" class="form-control fixed-width-lg pull-left" value=""/>

In override/controllers/admin/AdminOrdersController.php:

class AdminOrdersController extends AdminOrdersControllerCore {
//...
  	public function postProcess() {
		if (Tools::isSubmit('submitCustomField')) {
            // Just to see if it catches it.. File created.
            file_put_contents( 'test1', 'See me?' );
            // The value is of course not fetched. File created.
			file_put_contents( 'test2', json_encode( Tools::getValue('custom_field') ) );
        }
 	}

Why doesn't it work?

Even better solution would be to get this value in the hook "actionSetInvoice". Tried all things I can think of in the hook too but does not work.

So, after 3 hours of googling and reading and testing... how on earth do you get a custom field value on submit in back office or in the hook?

PS version: latest

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