Jump to content

How to add custom field using displayBeforeCarrier

Recommended Posts


I am trying to add a new field in checkout process using a hook "displayBeforeCarrier" and i have a mymodulename.tpl file: 

<form class="clearfix" method="post">
    <h6>Proof of purchase:</h6>
            <span class="custom-radio float-xs-left">
                <input class="ps-shown-by-js" id="invoice_receipt_1" name="invoice_receipt" type="radio" value="1" {if $defaultvalue eq '1'}checked{/if}/>    
            <label for="invoice_receipt_1">
                <span style="padding: 0px 15px;">{l s='Invoice' mod='needinvoicefield'}</span>
            <span class="custom-radio float-xs-left">
                <input class="ps-shown-by-js" id="invoice_receipt_0" name="invoice_receipt" type="radio" value="0" {if empty($defaultvalue) || $defaultvalue eq '0'}checked{/if}/>
            <label for="invoice_receipt_0">
                <span style="padding: 0px 15px;">{l s='Receipt' mod='needinvoicefield'}</span>


and I want to retrieve the value of this field at the time of the "actionValidateOrder":

public function hookActionValidateOrder($params)
        $order = $params['order'];               
        $proof_of_purchase = Tools::getValue('invoice_receipt'); 
        $sql = 'UPDATE `'._DB_PREFIX_.'orders` SET `need_invoice` = '.(int)$proof_of_purchase.' WHERE `id_order` = '.(int)$order->id.'';

but line:  $proof_of_purchase = Tools::getValue('invoice_receipt');  doesn't work. I think that is because my form was not sent via GET or POST. 

Does anyone know how i can retrieve the "invoice_receipt" value?

Hope someone can help me !

Share this post

Link to post
Share on other sites
  • 5 months later...

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

Important Information

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